py-why / py-why/causal-learn

BOSS algorithm

Open
#218 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
274
PR merge metrics
No merged PRs in 30d

Description

I feed the BOSS() with a continuous dataset and get the following error message about singular matrix, is this expected?

Traceback (most recent call last):
  File "/home/min/a/lee4094/projects/bayesian_rcd/experiment_sockshop.py", line 203, in <module>
    cpdag  = boss(df_n_without_time.to_numpy(), score_func='local_score_BIC')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/causallearn/search/PermutationBased/BOSS.py", line 145, in boss
    gsts[v].trace(order[:i], parents[v])
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/causallearn/search/PermutationBased/gst.py", line 69, in trace
    return self.root.trace(prefix, available, parents)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/causallearn/search/PermutationBased/gst.py", line 44, in trace
    if self.branches is None: self.grow(available, parents)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/causallearn/search/PermutationBased/gst.py", line 20, in grow
    score = -self.tree.score.score_nocache(self.tree.vertex, parents)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/causallearn/score/LocalScoreFunctionClass.py", line 52, in score_nocache
    return self.local_score_fun((self.cov, self.n), i, PAi, self.parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/causallearn/score/LocalScoreFunction.py", line 73, in local_score_BIC_from_cov
    H = np.log(cov[i, i] - yX @ np.linalg.inv(XX) @ yX.T)
                                ^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/numpy/linalg/linalg.py", line 561, in inv
    ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/min/a/lee4094/miniconda3/envs/bayes_rcd/lib/python3.11/site-packages/numpy/linalg/linalg.py", line 112, in _raise_linalgerror_singular
    raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported BOSS call from causallearn/search/PermutationBased/BOSS.py, then trace the failure through causallearn/search/PermutationBased/gst.py and causallearn/score/LocalScoreFunction.py. Check the continuous dataset and covariance inputs around local_score_BIC_from_cov; done means determining whether the singular matrix is expected and documenting or addressing the confirmed cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.