py-why / dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
https://www.pywhy.org/dowhy
MIT License
7.14k stars 935 forks source link

'squared' is deprecated error while running evaluate_causal_model #1236

Closed newbietogitdotcom closed 3 months ago

newbietogitdotcom commented 3 months ago

Thank you for creating this awesome library!. I got a question

Here is my code

from dowhy import gcm

Create the structural causal model object

scm = gcm.StructuralCausalModel(causal_graph)

Automatically assign generative models to each node based on the given data

auto_assignment_summary = gcm.auto.assign_causal_mechanisms(scm, df13)

print(auto_assignment_summary)

Fit causal models to data

learn the parameters of the model

gcm.fit(scm, df13)

print(gcm.evaluate_causal_model(scm, df13, compare_mechanism_baselines=True, evaluate_invertibility_assumptions=False))

While the code runs fine, during its progress i get below error

"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sklearn/metrics/_regression.py:483: FutureWarning: 'squared' is deprecated in version 1.4 and will be removed in 1.6. To calculate the root mean squared error, use the function'root_mean_squared_error'. warnings.warn("

How do i avoid this error ?

bloebp commented 3 months ago

Hey, it seems this is a warning, not an error, i.e., you can ignore it for now. Nevertheless, it is something we need to change. I will put it on the backlog. Thanks a lot for flagging!

newbietogitdotcom commented 3 months ago

Okay great, thank you!

bloebp commented 3 weeks ago

Just following-up on this, this actually seems to be coming from scikit-learn not from DoWhy. You might just need to update scikit learn.