Pc fci fast haoyue #6
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
optimize speed for PC and FCI
change overview
I mainly did two things:
These two optimizations are faithful to original code (same calculation, same procedure, same result, no approximation). The only difference is speed. And the larger data is, the more speedup we'll get (#subsets exponential to #nodes).
result overview
tests/folder the discrete data are not large enough. So I used some data from bnlearn with samplesize=10,000. See./TestData/bnlearn_discrete_10000.9b8f06fversion @12/13/2021.TestPC.pyand run respectively.causal-learn-oldandcausal-learn-newruns exactly the same procedure. But not sure about parameters/operations inside are same inTetradandpcalg.time (sec)
time (sec)
On
./data_linear_10.txt, old FCI uses 4.41656s, and new FCI uses 1.87639s. This difference is only due to cache.Also checkout
Thanks Wei's for earlier optimization on FCI at commit 9b8f06f. Compare release 0.1.2.0 vs 0.1.1.9, FCI is also dozens of times faster.