SelfExplainML / PiML-Toolbox

PiML (Python Interpretable Machine Learning) toolbox for model development & diagnostics
https://selfexplainml.github.io/PiML-Toolbox
Apache License 2.0
931 stars 111 forks source link

Elastic net removes all predictors #28

Closed xloffree closed 1 year ago

xloffree commented 1 year ago

Hi,

When I try to run elastic net in PiML, I can get an r2 value and other global interpretability metrics, but when I try to look at the influence of individual predictors, I see that the model has removed each predictor. When running code in sklearn that should give identical results, elastic net does not remove all of the predictors. I am not sure what is going on here. Perhaps it is some kind of bug?

Thank you

CnBDM-Su commented 1 year ago

Hi,

When I try to run elastic net in PiML, I can get an r2 value and other global interpretability metrics, but when I try to look at the influence of individual predictors, I see that the model has removed each predictor. When running code in sklearn that should give identical results, elastic net does not remove all of the predictors. I am not sure what is going on here. Perhaps it is some kind of bug?

Thank you

Hi @xloffree , Can you offer the code you used? Then I can do the test for answering your question. Thanks

xloffree commented 1 year ago

Screenshot (313) Screenshot (312) Screenshot (311) Screenshot (310) Screenshot (309)

As you can see, I am running elastic net in PiML and sklearn. I should be getting the same results, or at the very least, PiML elastic net should not be removing every predictor.

ZebinYang commented 1 year ago

Hi @xloffree,

Note that the data used by PiML is preprocessed to be within 0 and 1. If you want to get the same results as sklearn's ElasticNest, please fit the model using the data preprocessed by PiML.

train_x, train_y, sample_weight_train = exp.get_data(train=True)