Feature request: include mean absolute error (MAE) as scorer in sklearn.linear_model.ElasticNetCV
See original GitHub issueDescription
In scikit-learn v0.19.0, ElasticNet minimizes the objective function:
1 / (2 * n_samples) * ||y - Xw||^2_2
+ alpha * l1_ratio * ||w||_1
+ 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2
.
In words, the objective function is mean squared error (MSE) loss on the predicted variable, plus regularization terms. My feature request is to include an argument (with ‘mse’ as its default value) that would allow the user to switch to mean absolute error (MAE) loss on the predicted variable. For the equivalent in R, see https://cran.r-project.org/web/packages/glmnet/glmnet.pdf, particularly the documentation for cv.glmnet:
type.measure=“mae” (mean absolute error) can be used by all models except … “cox”
It would be great to also allow this functionality in sklearn.
Edit: as @agramfort pointed out below, glmnet only supports MAE for cross-validation, but not for model fitting. My request is to add an option for MAE in sklearn ElasticNet model fitting. This already exists in sklearn.ensemble.GradientBoostingRegressor (loss=‘quantile’ and alpha=0.50), if I am reading the documentation correctly. There’s also a linear-regression-with-MAE-loss option in sklearn.linear_model.HuberRegressor.html, if epsilon=0.0 (“The Huber Regressor optimizes the squared loss for the samples where |(y - X'w) / sigma| < epsilon
and the absolute loss for the samples where |(y - X'w) / sigma| > epsilon
”).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top GitHub Comments
now we “just” need someone to take a stab at it 😃
Ok. I’m glad you think it’s doable and useful!