Skip to content

DoSampler: Fails when you Add a Graph to the Causal Model #83

@cschiri

Description

@cschiri

Regards,

I noticed something that I do not understand at this stage:

The DoSampler works fine when you do not add a graph to your CausalModel object, but fails when you add a graph. To elaborate:

This model object, which I will name "a" and does not have a graph. It doesn't give you problems:

# Define causes, Outcomes and Common Causes
causes = ['v']
outcomes = ['y']
common_causes = ['x1',
                 'x4',
                 'x5',
                 'x6']

model = CausalModel(df, 
                    causes,
                    outcomes,
                    common_causes=common_causes)

This model object, which I will name "b", has a graph as an input. It gives you problems;

# Define causes, Outcomes and Common Causes
causes = ['v']
outcomes = ['y']
common_causes = ['x1',
                 'x4',
                 'x5',
                 'x6']
graph = "digraph {x1 -> y;v -> y;x6 -> y;x6 -> x5;x4 -> x5;}"

model = CausalModel(df, 
                    causes,
                    outcomes,
                    common_causes=common_causes,
                    graph=graph)

To be specific the model object formulation named "b" gives you problems when you try to create the interventional dataframe as follows:

interventional_df = sampler.do_sample(None)

It gives you the following "value error":

ValueError: Found array with 0 feature(s) (shape=(46, 0)) while a minimum of 1 is required.

Why is this so?

Best
-C.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions