cdt15 / lingam

Python package for causal discovery based on LiNGAM.
https://sites.google.com/view/sshimizu06/lingam
MIT License
356 stars 54 forks source link

Error in visualize_nonlinear_causal_effect #140

Closed hendriklohse closed 2 weeks ago

hendriklohse commented 3 weeks ago

The example of utils.visualize_nonlinear_causal_effect does not seem to work anymore.

When running it, you get a problem with the shape of cd_result. The error occurs at _is_adjacency_matrix(cd_result, X.shape[1]) and is caused by check_array(cd_result). It yields ValueError: Expected 2D array, got scalar array instead.

How can this be fixed?

ikeuchi-screen commented 2 weeks ago

Hi @hendriklohse , I did not get any errors with the example code in my environment. Are you setting the bootstrap result in the argument bs_result?

fig = visualize_nonlinear_causal_effect(X, bs_result, RandomForestRegressor(), "X2", "X3", fig=fig)