Skip to content

Commit

Permalink
add docs for ConfusionMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Jul 11, 2016
1 parent bb35d04 commit ba89274
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 44 additions & 0 deletions docs/machine-learning/metric/confusion-matrix.md
Original file line number Diff line number Diff line change
@@ -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],
];
*/
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ba89274

Please sign in to comment.