_metrics
accuracy_score(y_true, y_pred, normalize=True)
⚓︎
Calculate the accuracy score from a given array of true labels and a given array of predicted labels.
Inspired by https://stackoverflow.com/a/64680660
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true |
2d ndarray
|
array of shape (n_samples, 1) of true labels |
required |
y_pred |
2d ndarray
|
array of shape (n_samples, 1) of predicted labels |
required |
Returns:
Name | Type | Description |
---|---|---|
accuracy_scores |
float
|
calculated accuracy score |
Raises:
Type | Description |
---|---|
ValueError
|
if y_true and y_pred are not of the same shape |
Source code in mlproject/helpers/_metrics.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|