py-why / py-why/causal-learn

FCM lags suspicious results

Open
#152 5 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

Hi there,
I wanted to see the effects of lagged variables on the car dataset so I did a quick sanity check:

from causallearn.search.FCMBased import lingam

for lags in range(1,4):
  print("\n\nLags %d" % lags)
  print("Total columns %d " % data.shape[1])
  model = lingam.VARLiNGAM(lags=lags,random_state=1,prune=False)
  model.fit(data)

  print("Causal Order features %d " % len(model.causal_order_))
  print(model.causal_order_)
  print("Matrix lags %d " % model.adjacency_matrices_.shape[0])
  #print(model.adjacency_matrices_[0])
  #print(model.adjacency_matrices_[1])
  #print(model.residuals_)

The output doesn't show any influence of the lag factor, see below:

Lags 1
Total columns 10 
Causal Order features 10 
[4, 8, 1, 6, 3, 0, 2, 7, 5, 9]
Matrix lags 2 


Lags 2
Total columns 10 
Causal Order features 10 
[4, 8, 1, 6, 3, 0, 2, 7, 5, 9]
Matrix lags 2 


Lags 3
Total columns 10 
Causal Order features 10 
[4, 8, 1, 6, 3, 0, 2, 7, 5, 9]
Matrix lags 2 

I would expect that the matrix lag and the causal order features increases as the lag increases?
For example when Lag is equal to 2, I should see double the columns and features?

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 with causallearn.search.FCMBased.lingam.VARLiNGAM and reproduce the provided car-dataset snippet for lags 1 through 3. Inspect how causal_order_ and adjacency_matrices_ are defined and populated, then resolve whether the observed shapes are intended or indicate a lag-handling bug.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.