Welcome to our Support Center

LogCoshError

Description

Computes the logarithm of the hyperbolic cosine of the prediction error. Type : polymorphic.

 

 

Input parameters

 

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

 

Output parameters

 

log_cosh_error : float, result.

Use cases

The LogCosh loss function, is a metric used in machine learning, specifically for regression problems. It is an alternative to mean square loss and mean absolute loss, and is particularly useful when there are outliers in the data. It is the logarithmic function of the hyperbolic cosine of the prediction error. It acts as a root-mean-square loss for small errors and as a root-mean-absolute loss for large errors. This makes it less sensitive to outliers than mean square loss.

Here are a few specific areas of application :

    • Price prediction : in econometrics or finance, the LogCosh loss function can be used to predict the prices of real estate, stocks, etc. These data can often have outliers. These data can often have significant outliers, such as sudden price changes or extremely high values.
    • Demand prediction : in supply chain management or logistics, the LogCosh loss function can be used to predict product demand. These predictions can also be affected by outliers, such as sudden and unexpected demand for a product.
    • Air quality prediction : in environmentalism or public health, the LogCosh loss function can be used to predict air quality. These data may have outliers due to events such as forest fires or industrial pollution.

 

Calculation

The cosh(x) function is very similar to the |x| function, but is gentler on small values of x. When applied to the difference between the predicted value and the true value, it gives a less severe penalty for large errors compared with the Mean Squared Error.

The logarithm is then applied to further attenuate the effect of large errors and give greater weight to small errors. In this way, log-cosh loss provides a robust measure of regression error that is less sensitive to outliers.

 

Example

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