Welcome to our Support Center



Computes the mean squared logarithmic error between y_true and y_pred. Type : polymorphic.



Input parameters


Β y_pred :Β array,Β predicted values.
Β y_true :Β array,Β true values.


Output parameters


mean_squared_logarithmic_error : float, result.

Use cases

The Mean Squared Logarithmic Error (MSLE) metric is often used in machine learning, specifically in regression problems. It is particularly useful when you want to focus on relative rather than absolute errors, and when you want to penalize large errors less than Mean Squared Error (MSE).

Here are a few specific areas where MSLE is commonly used :

    • Sales forecasting: In sales forecasting problems, MSLE can be used to assess how much a model’s sales forecast differs from actual sales in percentage terms, rather than in absolute terms.
    • Demand forecasting: In demand forecasting problems, such as electricity demand forecasting, MSLE can be used to assess the percentage error, which can help to understand the error in terms of capacity or total demand.
    • Finance: In problems involving the prediction of share prices or other financial values, MSLE can be used to assess the extent to which model predictions differ from the actual price in percentage terms.

The advantage of MSLE is that it focuses on relative rather than absolute errors, which can be useful when the magnitude of the variable you are trying to predict varies greatly. It is also less sensitive to large errors than MSE, which can be useful when you want to avoid giving too much importance to outliers.


The Mean Squared Logarithmic Error (MSLE) is a metric adapted to regression problems where we want to give more importance to errors on small values. For each prediction (y_pred) and each true value (y_true), we first check whether they are negative. If they are, we replace them with zero. Next, we apply the logarithm of each value plus one (to avoid infinite values), calculate the difference between these logarithms and square this difference. The average of these values for all the samples gives the MSLE. A smaller MSLE means a better model fit.



All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install HAIBAL library to run it).

Easy to use

Table of Contents