FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.08k stars 198 forks source link

ValueError when running VarLiNGAM #56

Open shisi-cc opened 4 years ago

shisi-cc commented 4 years ago

When I run VarLiNGAM on Finance dataset (http://www.skleinberg.org/data/FinanceCPT.tar.gz), I meet a ValueError. df_data = pd.read_csv(datafile) model = VarLiNGAM(lag=3) result = model.create_graph_from_data(df_data) The error is as follows

File "", line 1, in runfile('F:/work_python_d_2/TimeSeriesCausalDiscovery/VARLiNGAM/VARLiNGAM_Finance.py', wdir='F:/work_python_d_2/TimeSeriesCausalDiscovery/VARLiNGAM')

File "D:_work\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile execfile(filename, namespace)

File "D:_work\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "F:/work_python_d_2/TimeSeriesCausalDiscovery/VARLiNGAM/VARLiNGAM_Finance.py", line 31, in G = model.create_graph_from_data(df_data)

File "D:_work\Anaconda3\lib\site-packages\cdt\timeseries\graph\VARLiNGAM.py", line 75, in create_graph_from_data inst, lagged = self._run_varLiNGAM(data.values, verbose=self.verbose)

File "D:_work\Anaconda3\lib\site-packages\cdt\timeseries\graph\VARLiNGAM.py", line 109, in _runvarLiNGAM Bhat = np.dot((Ident - Bo), Mt)

ValueError: shapes (25,25) and (75,25) not aligned: 25 (dim 1) != 75 (dim 0)

diviyank commented 4 years ago

Hi, The data might not be in the good format; Let's ask @koutrgor for more details;