question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add MSLE(Mean Squared Logarithmic Error) to TreeRegressors

See original GitHub issue

Describe the workflow you want to enable

from sklearn.tree import DecisionTreeRegressor
model = DecisionTreeRegressor(criterion = 'msle')

There are some differences between MSE and MSLE. First, MSLE only cares about the percentual differences. And second, MSLE penalizes underestimates more than overestimates.

Especially, in business, I frequently meet the situation which should handle underestimation. When we forecast delivery time, for example, data analysts want to calculate delivery time conservatively to avoid VOC. Sometimes, they just added +10 minutes to their model’s result. I remind them that they could convert their label y to log scale and put them in the model to compute error as logarithmic error, but they didn’t just because it seems difficult.

I think, if there is more criterion option, logarithmic error, in the basic model like trees, analysts could handle this problem easily.

Describe your proposed solution

Add logarithmic error to sklearn/tree/_criterion.c Add logarithmic error to sklearn/tree/_classes.py

CRITERIA_REG = {"mse": _criterion.MSE, "friedman_mse": _criterion.FriedmanMSE, "mae": _criterion.MAE, "msle": _criterion.MSLE}

Add documentation about MSLE or comparison between MSE and MSLE

Describe alternatives you’ve considered, if relevant

Just add documentation about MSLE and MSE, and share how to compute logarithmic error with MSE criterion in trees.

Additional context

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
GrzegorzRutcommented, Feb 12, 2021

https://orsociety.tandfonline.com/doi/full/10.1057/jors.2014.103 has more than 200 citations, was published over 5 years ago, MSLE is an improvement over MAPE

0reactions
jnothmancommented, Feb 13, 2021

It might be helpful to have MSLE in our metrics module before trying to make it available as a tree criterion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sklearn.metrics.mean_squared_log_error
Errors of all outputs are averaged with uniform weight. squaredbool, default=True. If True returns MSLE (mean squared log error) value. If False returns...
Read more >
Understanding the metric: RMSLE - Kaggle
In this kernel we take a deep dive into Root Mean Squared Logarithmic Error (RMSLE). This is the metric used for the ASHRAE...
Read more >
msle: Mean Square Logarithmic Error in mltools - Rdrr.io
For the ith sample, Squared Logarithmic Error is calculated as SLE = (log(prediction + 1) - log(actual + 1))^2. MSE is then mean(squared...
Read more >
Metrics - MSE, R^2, RMSLE - Data to Wisdom
Root Mean Squared Logarithmic Error (RMSLE). We will later add new metrics to this notebook by time. ruler ...
Read more >
1 Real-time data-driven missing data imputation for short-term ...
tree regressors, and ensemble methods (Bagged trees (with SVR and k-NN ... (MSE), Mean Squared Logarithmic Error (MSLE), the Root Mean Square Error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found