2016-04-08 22:36:48 +00:00
|
|
|
# Accuracy
|
|
|
|
|
|
|
|
Class for calculate classifier accuracy.
|
|
|
|
|
|
|
|
### Score
|
|
|
|
|
2016-05-02 11:49:19 +00:00
|
|
|
To calculate classifier accuracy score use `score` static method. Parameters:
|
2016-04-08 22:36:48 +00:00
|
|
|
|
|
|
|
* $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
|
|
|
|
```
|