Bundle Core machine learning types: the seedable Random generator, Matrix2D linear algebra and activations, matrix reference holders, the NeuralNetwork and CSV-backed MatrixReader. Compile with -lib ml.
Metrics
Model evaluation metrics for classification tasks
Operations
Accuracy # native
Calculates accuracy: (TP + TN) / Total
function : native : Accuracy(predictions:Bool[], actuals:Bool[]) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| predictions | Bool | predicted boolean values |
| actuals | Bool | actual boolean values |
Return
| Type | Description |
|---|---|
| Float | accuracy score between 0.0 and 1.0 |
ConfusionMatrix # native
Creates a confusion matrix
function : native : ConfusionMatrix(predictions:Bool[], actuals:Bool[]) ~ Int[,]Parameters
| Name | Type | Description |
|---|---|---|
| predictions | Bool | predicted boolean values |
| actuals | Bool | actual boolean values |
Return
| Type | Description |
|---|---|
| Int | 2x2 confusion matrix [[TN, FP], [FN, TP]] |
F1Score # native
Calculates F1 score: 2 * (Precision * Recall) / (Precision + Recall)
function : native : F1Score(predictions:Bool[], actuals:Bool[]) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| predictions | Bool | predicted boolean values |
| actuals | Bool | actual boolean values |
Return
| Type | Description |
|---|---|
| Float | F1 score between 0.0 and 1.0 |
MCC # native
Calculates Matthews Correlation Coefficient (MCC)
function : native : MCC(predictions:Bool[], actuals:Bool[]) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| predictions | Bool | predicted boolean values |
| actuals | Bool | actual boolean values |
Return
| Type | Description |
|---|---|
| Float | MCC score between -1.0 and 1.0 |
Precision # native
Calculates precision: TP / (TP + FP)
function : native : Precision(predictions:Bool[], actuals:Bool[]) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| predictions | Bool | predicted boolean values |
| actuals | Bool | actual boolean values |
Return
| Type | Description |
|---|---|
| Float | precision score between 0.0 and 1.0 |