Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: translate the coeficients of linear model to real scale #1367

Open
MarieSacksick opened this issue Feb 27, 2025 · 2 comments
Open

enh: translate the coeficients of linear model to real scale #1367

MarieSacksick opened this issue Feb 27, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@MarieSacksick
Copy link
Contributor

MarieSacksick commented Feb 27, 2025

Is your feature request related to a problem? Please describe.

Due to the scaling done prior to linear models, we can not interpret the coefficient values with regards to the original unit of the feature, while it is interesting, in particular in regression.
It would be nice to provide easily unscaled coefficients, without forgetting the intercerpt, so that the coefficients can interpreted using the original units.

Describe the solution you'd like

Maybe what is done in

# %%
import numpy as np
unscaling_weights = np.insert(ridge_report.estimator_[0].scale_, 0, 1, axis=0).reshape(
-1, 1
)
ridge_report.feature_importance.coefficients() * unscaling_weights
(lines 259 to 265)

Describe alternatives you've considered, if relevant

No response

Additional context

cf the example plot_feature_importance.py

@glemaitre
Copy link
Member

It could be tricky when you have a complex preprocessing, e.g. a step with PolynomialFeatures or PCA. So we would need to think thoroughly this feature to know in which case we can provide it and thus what should control the behaviour.

@MarieSacksick
Copy link
Contributor Author

Yes, at first I thought it could be a "good first issue" since the code was available in Sylvain's notebook. And then I realized it wouldn't be :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants