Comments (6)
Hi, we have updated our code (#58). We believe it's related to the original data, which might not satisfy the assumption of the singularity of its covariance matrix, so we throw an exception in that case. Please let us know if you think there are other reasons. Many thanks!
from causal-learn.
Thanks for letting us know. We will look into this. Meanwhile, if possible, could you please share a minimal code and sample dataset that could reproduce that issue?
from causal-learn.
I get this error too, I stuck in some debug lines in the fisherz function and here are the variable values right before the crash:
var
[80, 8, 81, 82]
sub_corr_matrix
[[ 1. 0.05900512 -0.53968299 -0.77947494]
[ 0.05900512 1. -0.04393224 -0.0369982 ]
[-0.53968299 -0.04393224 1. -0.10670507]
[-0.77947494 -0.0369982 -0.10670507 1. ]]
sub_corr_matrix determinant -1.356916280487041e-15
inverse of sub_corr_matrix
[[-7.25887259e+14 -2.94842405e-01 -4.57331063e+14 -6.14610472e+14]
[-3.00253318e-01 1.00370143e+00 -1.40868234e-01 -2.12238508e-01]
[-4.57331063e+14 -1.37148843e-01 -2.88132487e+14 -3.87223301e+14]
[-6.14610472e+14 -2.07321594e-01 -3.87223301e+14 -5.20392152e+14]]
The problem appears to be that elements in the inverse matrix are going to negative infinity. Why that is, I have no idea.
from causal-learn.
Sorry to intrude, but is it possible the matrix is not singular so when you invert it you don't get a proper inverse? Have you tried multiplying the inverse by the matrix to see if you get I?
from causal-learn.
I multiplied the matrix and inverse matrix together like you suggested and did not get I or anything close. I checked the determinant of the matrix and it is basically 0. I researched this problem and numpy many times does not catch "basically 0" due to floating point math oddities so something is never 0 but will instead be e.g. 2.8e-14. They added an isclose function but I don't know enough about the math involved in causal-learn to guess what a good epsilon value would be to separate matrixes with legitimately very small determinants from matrixes whose determinant really is 0.
from causal-learn.
Hi @delacylab,
Thanks for researching, and finding the root cause.
Do you mind adding an assertion in our codebase to ensure the matrix is not singular before calling inverse?
In this way, we can throw a better error message to users so they know it's data issue, instead of the current confusing error message.
Of course, if you don't have time, please let us know! And we will find someone to implement this.
from causal-learn.
Related Issues (20)
- FCM lags suspicious results HOT 5
- PNL - Test2 HOT 3
- Data correlation matrix is singular HOT 5
- when will the Causal-Learn support causal evaluation HOT 2
- Reference PC stable HOT 1
- FCI implementation HOT 7
- Questions about is_dseparated_from HOT 3
- Using FCI with true graph known, specifying latent variables and background knowledge? HOT 8
- does this codebase support some recent causal discovery methods like, notears, dag-gnn,and so on HOT 2
- A potential Bug in GES.py HOT 1
- Null Hypothesis in Conditoinal Independence Tests HOT 2
- How to construct a causallearn.graph.Graph object from an numpy array? HOT 2
- Boostrap Utilities HOT 1
- Background knowledge not used correctly? HOT 1
- Implementation for CCI? HOT 1
- How to estimate the causal effect? HOT 1
- Different results with Tetrad and causal-learn implementations. HOT 6
- numpy version HOT 1
- Understanding the FCI outputs (graph vs. printed edges) HOT 3
- Handling Data with Interventions 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.