Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prior Knowledge Module not Registering all Forbidden Variables #94

Open
cschiri opened this issue Apr 7, 2020 · 1 comment
Open

Prior Knowledge Module not Registering all Forbidden Variables #94

cschiri opened this issue Apr 7, 2020 · 1 comment

Comments

@cschiri
Copy link

cschiri commented Apr 7, 2020

Regards,

I am using pycausal in:

  • Anaconda's distribution of Python 3.7.

  • Windows 8.1

Everything is working superbly. However, I am having issues with the Prior Knowledge module.

My dataframe has:

  • Two independent variables named "y1" and "y2". There is no causal relationship between the variables, and, temporally, they both precede the dependent variables that are listed below;

  • 19 dependent variables named "v1" to "v19". While they are interesting, at this stage I do not seek to discover the interrelationships between these dependent variables. I am only interested in their relationships to "y1" and "y2".

I fed this prior knowledge into pycausal as follows:

# Prior Knowledge

from pycausal import prior as pk

forbidden = [['v1', 'v2', 'v3', 'v4', 'v5', 'v6', 'v7',
              'v8', 'v9', 'v10', 'v11', 'v12', 'v13, 'v14',
              'v15', 'v16', 'v17', 'v18', 'v19']]

tempForbid = pk.ForbiddenWithin(['y1', 'y2'])

temporal = [tempForbid, ['v1', 'v2', 'v3', 'v4', 'v5', 'v6', 'v7',
              'v8', 'v9', 'v10', 'v11', 'v12', 'v13, 'v14',
              'v15', 'v16', 'v17', 'v18', 'v19']]

prior = pk.knowledge(forbiddirect = forbidden, addtemporal = temporal)
prior

However, not all, i.e. just two (of), the variables are being registered as the "forbiddirect" section of the following output shows:

Instance of edu.cmu.tetrad.data.Knowledge2: /knowledge
addtemporal

1* y1 y2
2  v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19

forbiddirect
v1 v2

requiredirect

Can you advise if there is anything wrong with the approach I am taking to code in prior knowledge?

Everything else works well, the subsequent parts my search, causal graph output etc work beautifully.

However, I just don't want to waste valuable time computing causal relationships (between "v#" variables) I am not interested in (my dataset is fairly big and I am using the bayesian search).

@chirayukong
Copy link
Collaborator

Could you help? @jdramsey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants