-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated and added documentation for grasp and boss respectively
- Loading branch information
Showing
4 changed files
with
86 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...source/search_methods_index/Permutation-based causal discovery methods/boss.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.. _GRaSP: | ||
|
||
GRaSP | ||
============================================== | ||
|
||
Algorithm Introduction | ||
-------------------------------------- | ||
|
||
Best order score search (BOSS) algorithm [1]_. | ||
|
||
|
||
Usage | ||
---------------------------- | ||
.. code-block:: python | ||
from causallearn.search.PermutationBased.BOSS import boss | ||
# default parameters | ||
G = boss(X) | ||
# or customized parameters | ||
G = boss(X, score_func, parameters) | ||
# Visualization using pydot | ||
from causallearn.utils.GraphUtils import GraphUtils | ||
import matplotlib.image as mpimg | ||
import matplotlib.pyplot as plt | ||
import io | ||
pyd = GraphUtils.to_pydot(G) | ||
tmp_png = pyd.create_png(f="png") | ||
fp = io.BytesIO(tmp_png) | ||
img = mpimg.imread(fp, format='png') | ||
plt.axis('off') | ||
plt.imshow(img) | ||
plt.show() | ||
Visualization using pydot is recommended (`usage example <https://github.com/cmu-phil/causal-learn/blob/main/tests/TestBOSS.py>`_). If specific label names are needed, please refer to this `usage example <https://github.com/cmu-phil/causal-learn/blob/e4e73f8b58510a3cd5a9125ba50c0ac62a425ef3/tests/TestGraphVisualization.py#L106>`_ (e.g., GraphUtils.to_pydot(G, labels=["A", "B", "C"]). | ||
|
||
Parameters | ||
------------------- | ||
**X**: numpy.ndarray, shape (n_samples, n_features). Data, where n_samples is the number of samples | ||
and n_features is the number of features. | ||
|
||
**score_func**: The score function you would like to use, including (see :ref:`score_functions`.). Default: 'local_score_BIC'. | ||
- ":ref:`local_score_BIC <BIC score>`": BIC score [3]_. | ||
- ":ref:`local_score_BDeu <BDeu score>`": BDeu score [4]_. | ||
- ":ref:`local_score_CV_general <Generalized score with cross validation>`": Generalized score with cross validation for data with single-dimensional variables [2]_. | ||
- ":ref:`local_score_marginal_general <Generalized score with marginal likelihood>`": Generalized score with marginal likelihood for data with single-dimensional variables [2]_. | ||
- ":ref:`local_score_CV_multi <Generalized score with cross validation>`": Generalized score with cross validation for data with multi-dimensional variables [2]_. | ||
- ":ref:`local_score_marginal_multi <Generalized score with marginal likelihood>`": Generalized score with marginal likelihood for data with multi-dimensional variables [2]_. | ||
|
||
**parameters**: Needed when using CV likelihood. Default: None. | ||
- parameters['kfold']: k-fold cross validation. | ||
- parameters['lambda']: regularization parameter. | ||
- parameters['dlabel']: for variables with multi-dimensions, indicate which dimensions belong to the i-th variable. | ||
|
||
|
||
|
||
Returns | ||
------------------- | ||
- **G**: learned general graph, where G.graph[j,i]=1 and G.graph[i,j]=-1 indicate i --> j; G.graph[i,j] = G.graph[j,i] = -1 indicates i --- j. | ||
|
||
|
||
.. [1] Andrews, B., Ramsey, J., Sanchez Romero, R., Camchong, J., & Kummerfeld, E. (2023). Fast scalable and accurate discovery of dags using the best order score search and grow shrink trees. Advances in Neural Information Processing Systems, 36, 63945-63956. | ||
.. [2] Huang, B., Zhang, K., Lin, Y., Schölkopf, B., & Glymour, C. (2018, July). Generalized score functions for causal discovery. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (pp. 1551-1560). | ||
.. [3] Schwarz, G. (1978). Estimating the dimension of a model. The annals of statistics, 461-464. | ||
.. [4] Buntine, W. (1991). Theory refinement on Bayesian networks. In Uncertainty proceedings 1991 (pp. 52-60). Morgan Kaufmann. |