Welcome to our Support Center

CategoricalHinge

Description

Computes the categorical hinge metric between y_true and y_pred. Type : polymorphic.

 

 

Input parameters

 

Β y_pred : array,Β predicted values (one hot probabilities for example, [0.1, 0.3, 0.6] for 3-class problem).
Β y_true : array,Β true values (one hot for example, [0, 0, 1] for 3-class problem).

 

Output parameters

 

categorical_hinge : float, result.

Use cases

The categorical hinge metric, also known as categorical margin loss, is a loss function used in machine learning for multiclass classification problems. For example, it could be used to train a model to classify images into different categories (such as different types of clothing) or to classify text documents into different genres. This metric is often used in the fields of computer vision and natural language processing, but can be applied to any multiclass classification task.

Calculation

The function calculates the difference between the true class and the predicted value, then takes the maximum between this difference and 0.

If the prediction is correct (if y_pred is equal to y_true), then the loss value is 0. If the prediction is incorrect, the loss value is the difference between the true class and the prediction.

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
Index