php-ml/docs/machine-learning/metric/accuracy.md
Attila Bakos 7d5c6b15a4 Updates to the documentation (linguistic corrections) (#414)
* Fix typo in Features list

* Update distance.md documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation

* Fix grammatical mistakes in documentation
2019-11-02 11:41:34 +01:00

25 lines
568 B
Markdown

# Accuracy
Class for calculating classifier accuracy.
### Score
To calculate classifier accuracy score, use the `score` static method. Parameters:
* $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
```