v2026.2.1
All Bundles

Metrics

Model evaluation metrics for classification tasks

Operations

Accuracy

Calculates accuracy: (TP + TN) / Total

function : native : Accuracy(predictions:Bool[], actuals:Bool[]) ~ Float

Parameters

NameTypeDescription
predictionsBoolpredicted boolean values
actualsBoolactual boolean values

Return

TypeDescription
Floataccuracy score between 0.0 and 1.0

ConfusionMatrix

Creates a confusion matrix

function : native : ConfusionMatrix(predictions:Bool[], actuals:Bool[]) ~ Int[,]

Parameters

NameTypeDescription
predictionsBoolpredicted boolean values
actualsBoolactual boolean values

Return

TypeDescription
Int2x2 confusion matrix [[TN, FP], [FN, TP]]

F1Score

Calculates F1 score: 2 * (Precision * Recall) / (Precision + Recall)

function : native : F1Score(predictions:Bool[], actuals:Bool[]) ~ Float

Parameters

NameTypeDescription
predictionsBoolpredicted boolean values
actualsBoolactual boolean values

Return

TypeDescription
FloatF1 score between 0.0 and 1.0

MCC

Calculates Matthews Correlation Coefficient (MCC)

function : native : MCC(predictions:Bool[], actuals:Bool[]) ~ Float

Parameters

NameTypeDescription
predictionsBoolpredicted boolean values
actualsBoolactual boolean values

Return

TypeDescription
FloatMCC score between -1.0 and 1.0

Precision

Calculates precision: TP / (TP + FP)

function : native : Precision(predictions:Bool[], actuals:Bool[]) ~ Float

Parameters

NameTypeDescription
predictionsBoolpredicted boolean values
actualsBoolactual boolean values

Return

TypeDescription
Floatprecision score between 0.0 and 1.0

PrintConfusionMatrix

Prints a formatted confusion matrix

function : native : PrintConfusionMatrix(matrix:Int[,]) ~ Nil

Parameters

NameTypeDescription
matrixInt2x2 confusion matrix

Recall

Calculates recall (sensitivity): TP / (TP + FN)

function : native : Recall(predictions:Bool[], actuals:Bool[]) ~ Float

Parameters

NameTypeDescription
predictionsBoolpredicted boolean values
actualsBoolactual boolean values

Return

TypeDescription
Floatrecall score between 0.0 and 1.0