mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-12-03 18:38:25 +00:00
25 lines
560 B
Markdown
25 lines
560 B
Markdown
|
# Accuracy
|
||
|
|
||
|
Class for calculate classifier accuracy.
|
||
|
|
||
|
### Score
|
||
|
|
||
|
To calculate classifier accuracy score use `score` static method. Parametrs:
|
||
|
|
||
|
* $actualLabels - (array) true sample labels
|
||
|
* $predictedLabels - (array) predicted labels (e.x. from test group)
|
||
|
* $normalize - (bool) normalize or not the result (default: true)
|
||
|
|
||
|
### Example
|
||
|
|
||
|
```
|
||
|
$actualLabels = ['a', 'b', 'a', 'b'];
|
||
|
$predictedLabels = ['a', 'a', 'a', 'b'];
|
||
|
|
||
|
Accuracy::score($actualLabels, $predictedLabels);
|
||
|
// return 0.75
|
||
|
|
||
|
Accuracy::score($actualLabels, $predictedLabels, false);
|
||
|
// return 3
|
||
|
```
|