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

Implement GES using causal-learn #29

Open
robertness opened this issue Aug 25, 2022 · 2 comments · May be fixed by #97 or #146
Open

Implement GES using causal-learn #29

robertness opened this issue Aug 25, 2022 · 2 comments · May be fixed by #97 or #146
Labels
good first issue Good for newcomers help wanted Extra attention is needed score-algorithm Score based discovery algorithms

Comments

@robertness
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
We need an initial score-based algorithm.

Describe the solution you'd like
Use causal-learn as a dependency to build GES

Describe alternatives you've considered
We could build it on our own, but causal-learn has a solid implementation and there is no need to reinvent the wheel

@adam2392
Copy link
Collaborator

adam2392 commented Sep 7, 2022

Here is a rendered doc that is a WIP of the PC algorithm API and its usage: https://output.circle-artifacts.com/output/job/4d057804-45d2-488b-89de-11fd8d37743c/artifacts/0/dev/index.html

This base class also defines the interface for any "constraint" causal discovery algorithm: https://github.com/py-why/dodiscover/blob/ab79e40853438ea6c5918554627b55a343c47ef2/dodiscover/constraint/_classes.py. Note this might change as Robert is updating the docs around Context vs data.

@adam2392
Copy link
Collaborator

adam2392 commented Sep 7, 2022

From the call, it seems the action items are:

  • implement a notebook/script that calls causal-learn and gets GES working on some example
  • write a function/class in dodiscover that wraps causal-learn's GES function and implements an api
  • add causal-learn to the pyproject.toml dev dependencies (I can help you do this)
  • write some unit/integration tests

There prolly will need to be some iterative discussion on the GES API. Basically, my general intuition is that all score-based algorithms should subclass a base class, or have a standard function signature.

Some thoughts on GES wrapping causal-learn

causal-learn docs contains the parametrization of GES in causal-learn. Note the differences relative to what dodiscover does.

  1. data is a numpy array rather than dataframe
  2. parameters imo should be "snake cased", like 'max_parents' instead of 'maxP'
  3. score function: should it be a Callable object, or str? If callable, then what is the expected signature of any score function? For example, see sklearn's metrics, which all have a standard function signature of y_true, y_pred, *, normalize=True, sample_weight=None.

By standardizing the interface that all score-based algorithms are called in dodiscover, we'll greatly simplify user life and future algorithms. Lmk if I missed anything?

@adam2392 adam2392 added the score-algorithm Score based discovery algorithms label Nov 21, 2022
@adam2392 adam2392 added good first issue Good for newcomers help wanted Extra attention is needed labels Jan 11, 2023
@adam2392 adam2392 linked a pull request Jan 13, 2023 that will close this issue
5 tasks
@adam2392 adam2392 linked a pull request Oct 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed score-algorithm Score based discovery algorithms
Projects
None yet
2 participants