mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-21 20:45:10 +00:00
add docs for ConfusionMatrix
This commit is contained in:
parent
bb35d045ba
commit
ba8927459c
@ -3,7 +3,11 @@ CHANGELOG
|
||||
|
||||
This changelog references the relevant changes done in PHP-ML library.
|
||||
|
||||
* 0.2.0 (in progress)
|
||||
* 0.2.0 (in plan)
|
||||
* feature [Dataset] - FileDataset - load dataset from files (folders as targets)
|
||||
* feature [Metric] - ClassificationReport - report about trained classifier
|
||||
|
||||
* 0.1.1 (2016-07-12)
|
||||
* feature [Cross Validation] Stratified Random Split - equal distribution for targets in split
|
||||
* feature [General] Documentation - add missing pages and fix links
|
||||
|
||||
|
@ -48,6 +48,7 @@ composer require php-ai/php-ml
|
||||
* [DBSCAN](http://php-ml.readthedocs.io/en/latest/machine-learning/clustering/dbscan/)
|
||||
* Metric
|
||||
* [Accuracy](http://php-ml.readthedocs.io/en/latest/machine-learning/metric/accuracy/)
|
||||
* [Confusion Matrix](http://php-ml.readthedocs.io/en/latest/machine-learning/metric/confusion-matrix/)
|
||||
* Workflow
|
||||
* [Pipeline](http://php-ml.readthedocs.io/en/latest/machine-learning/workflow/pipeline)
|
||||
* Cross Validation
|
||||
|
@ -48,6 +48,7 @@ composer require php-ai/php-ml
|
||||
* [DBSCAN](machine-learning/clustering/dbscan/)
|
||||
* Metric
|
||||
* [Accuracy](machine-learning/metric/accuracy/)
|
||||
* [Confusion Matrix](machine-learning/metric/confusion-matrix/)
|
||||
* Workflow
|
||||
* [Pipeline](machine-learning/workflow/pipeline)
|
||||
* Cross Validation
|
||||
|
44
docs/machine-learning/metric/confusion-matrix.md
Normal file
44
docs/machine-learning/metric/confusion-matrix.md
Normal file
@ -0,0 +1,44 @@
|
||||
# Confusion Matrix
|
||||
|
||||
Class for compute confusion matrix to evaluate the accuracy of a classification.
|
||||
|
||||
### Example (all targets)
|
||||
|
||||
Compute ConfusionMatrix for all targets.
|
||||
|
||||
```
|
||||
use Phpml\Metric\ConfusionMatrix;
|
||||
|
||||
$actualTargets = [2, 0, 2, 2, 0, 1];
|
||||
$predictedTargets = [0, 0, 2, 2, 0, 2];
|
||||
|
||||
$confusionMatrix = ConfusionMatrix::compute($actualTargets, $predictedTargets)
|
||||
|
||||
/*
|
||||
$confusionMatrix = [
|
||||
[2, 0, 0],
|
||||
[0, 0, 1],
|
||||
[1, 0, 2],
|
||||
];
|
||||
*/
|
||||
```
|
||||
|
||||
### Example (chosen targets)
|
||||
|
||||
Compute ConfusionMatrix for chosen targets.
|
||||
|
||||
```
|
||||
use Phpml\Metric\ConfusionMatrix;
|
||||
|
||||
$actualTargets = ['cat', 'ant', 'cat', 'cat', 'ant', 'bird'];
|
||||
$predictedTargets = ['ant', 'ant', 'cat', 'cat', 'ant', 'cat'];
|
||||
|
||||
$confusionMatrix = ConfusionMatrix::compute($actualTargets, $predictedTargets, ['ant', 'bird'])
|
||||
|
||||
/*
|
||||
$confusionMatrix = [
|
||||
[2, 0],
|
||||
[0, 0],
|
||||
];
|
||||
*/
|
||||
```
|
@ -14,6 +14,7 @@ pages:
|
||||
- DBSCAN: machine-learning/clustering/dbscan.md
|
||||
- Metric:
|
||||
- Accuracy: machine-learning/metric/accuracy.md
|
||||
- Confusion Matrix: machine-learning/metric/confusion-matrix.md
|
||||
- Workflow:
|
||||
- Pipeline: machine-learning/workflow/pipeline.md
|
||||
- Cross Validation:
|
||||
|
Loading…
Reference in New Issue
Block a user