Welcome to our Support Center

CategoricalAccuracy

Description

Calculates how often predictions match one-hot labels. Type : polymorphic.

 

 

Input parameters

 

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

 

Output parameters

 

categorical_accuracy : float, result.

Use cases

The categorical accuracy metric is used in multiclass classification problems in machine learning. In a multiclass classification problem, an output variable can have more than two possible states. For example, a machine learning algorithm could be trained to predict different species of animal, different types of car, different genres of film, and so on.

It is very useful for evaluating models in areas such as :

    • Image recognition : for example, classifying clothing images into different categories (pants, dresses, shoes, etc.).
    • Natural language processing : for example, classifying text documents into different categories (news, sports, politics, etc.).
    • Medicine : for example, classifying medical tissue samples into different disease categories.

 

Calculation

Before calculating this metric, argmax is always applied to y_pred and y_true on the last axis in order to determine the integer label. Then computes the frequency with which y_pred matches y_true. This frequency is ultimately returned as binary accuracy : an idempotent operation that simply divides total by count.

y_pred and y_true should be passed in as vectors of probabilities, rather than as labels.

 

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