arogozhnikov / hep_ml

Machine Learning for High Energy Physics.
https://arogozhnikov.github.io/hep_ml/
Other
176 stars 64 forks source link

GBReweighter KeyError: 'squared_error' ?? #74

Open oozcelik opened 2 years ago

oozcelik commented 2 years ago

Hello everyone,

I'm constantly getting an error of " squared_error" which actually does not help much to understand the issue. I attach the full error log. Screen Shot 2022-06-28 at 4 05 57 PM

and the piece of code where it complains is :

reweighter = reweight.GBReweighter(n_estimators=50, learning_rate=0.1, max_depth=3, min_samples_leaf=1000, gb_args={'subsample': 0.1}) reweighter.fit(original=original, target=target, original_weight=original_weights, target_weight=target_weights)

reweighter.fit(original, target)

weights = reweighter.predict_weights(original) draw_distributions(original, target, weights, target_weights)

Does anybody have any idea about what is wrong? Many thanks!

arogozhnikov commented 2 years ago

See the deprecation message from sklearn documentation:

Deprecated since version 1.0: Criterion “mse” was deprecated in v1.0 and will be removed in version 1.2. Use criterion="squared_error" which is equivalent.

I guess you need to update sklearn.

oozcelik commented 2 years ago

thanks for the response, I updated sklearn "pip install -U scikit-learn" now the version is scikit-learn-1.1.1 but I still get the exact same error. Do you reckon that I need to update any other packages?

arogozhnikov commented 2 years ago

Can't think about any other issue. Make sure to restart kernel, and verify sklearn by

print(sklearn.__version__)
caiovnd commented 1 year ago

Hi everyone,

I am having an issue similar to the one @oozcelik reported, as shown bellow. I tried to update sklearn, as suggested by @arogozhnikov but also got the same error message.

image

oozcelik commented 1 year ago

hi, I managed to get it work after deleting some files in my CERN BOX which causes conflict.

caiovnd commented 1 year ago

Hi @oozcelik, what do you mean when you say that some files were causing conflict? I am not sure about which files I have might be related to this problem.

arogozhnikov commented 1 year ago

ensure you do use the new version of sklearn (should be run within the same process/notebook as hep_ml): print(sklearn.__version__)