Comments (4)
The issue I think is that checking background knowledge requires an overhead, so if you don't have to do it the algorithms will run faster.
The way it's stored is in pairs <{n1, ..., nm>, {nq...nr}>, where edges are forbidden in reverse. The set lookups should be fast (i.e., if you forbid all of the second from causing any of the first, and you try to add an edge x1->x2, if will look to see if x1 is in the second set and x2 is in the first set and if so will forbid it). If you give separate singleton pairs for each, like <{x1}, {x2}>, it has to go through a lot of sets to figure this out. Do you know how your knowledge is being entered?
from causal-learn.
Thank you for your reply! I store the forbidden and required edges in self.forbidden_rules_specs and self.required_rules_specs for the BackgroundKnowledge class which I thought only allow singleton pairs, since the type is Set[Tuple[Node, Node]]
. That explains why the algorithm is slower then. But how can I change then then to the pairs with multiple values?
from causal-learn.
Hi, I have added a childclass of this BackgroundKnowledge class called FastBackgroundKnowledge in my code which inherits all the properties of the BackgroundKnowledge, except for the is_forbidden() and is_required() functions to fix my problem.
I have added two dictionaries for which the required and forbidden edges are stored in. For each required edge X1 -> X2 we have a dict_required {"X1" : [X2]}. This way the is_forbidden()
function and is_required()
function do not have to look through all sets, but has a lookup by node name. This has lowered the FCI function computation time significantly!
There is only one problem, in the file fas.py
line 286, type checking has been done by stating type(knowledge) == BackgroundKnowledge
I would like to suggest to change this to isinstance(knowledge, BackgroundKnowledge)
, such that inheritance is possible :)
from causal-learn.
Thanks so much! Your solution looks fantastic : ) If you would like to, could you please create a PR (including a short test example) for this so that your contribution could be better recognized? We can also review and push this if everything goes smoothly. Of course, we greatly appreciate your suggestions whether you would like to PR it or not.
from causal-learn.
Related Issues (20)
- [RFC, META-ISSUE] Complete continuous integration (CI) for unit-testing, documentation, and test coverage HOT 4
- QUESTION: To get DAG/Graph from FCM-based methods HOT 1
- Add Error Handling for cit.py line 165/166 HOT 3
- Derivation of the Fisher-z independence test HOT 1
- the direct of two nodes in adjacency matrix which is result of ICALiNGAM HOT 3
- Passing required domain knowledge using add_required_by_node HOT 3
- GeneralGraph.subgraph bug HOT 1
- math domain error HOT 6
- I could add cluster background knowledge HOT 2
- p-values for edges using FCI HOT 1
- operands could not be broadcast together with shapes error with GES HOT 1
- PC algorithm graph matrix syntax
- GES graph node names issue HOT 1
- PC algorithm logic HOT 2
- Generalized score with mixed data HOT 1
- Using scoring function 'local_score_marginal_multi' on ges() function gives error HOT 5
- PC algorithm and Meek rules HOT 9
- FAS does not use required edges anymore HOT 3
- Question: Clarification on Edge properties from FCI algo HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from causal-learn.