Welcome to our Support Center



Calculates the number of true positives. Type : polymorphic.



Input parameters


Β y_pred :Β array,Β predicted values (logits values).
Β y_true :Β array,Β true values (logits values, or binary values if the threshold value is between 0 and 1).
Β thresholds :Β float,Β representing the threshold for deciding whether prediction and true values are 1 or 0 (above the threshold is true, below is false).


Output parameters


true_positives : float, result.

Use cases

The “TruePositives” metric is widely used in machine learning, particularly in binary and multi-label classification tasks. A “true positive” occurs when the model correctly predicts that an example belongs to the positive class.

Here are a few examples of areas where the “TruePositives” metric is used :

    • Spam filtering : an email is spam and the model correctly predicts it as spam.
    • Medical diagnosis : a patient has a certain disease and the model correctly predicts that the patient has this disease.
    • Fraud detection : a transaction is fraudulent and the model correctly predicts that it is fraudulent.
    • Object recognition in images : a specific object is present in an image and the model correctly predicts that this object is present.



“TruePositives” is a metric used in binary classification.

A “True Positive” (TP) occurs when a model correctly predicts the positive class for an example that is actually of the positive class. In other words, the model predicted that the event would occur, and it did.



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