@@ -4,19 +4,14 @@ The K Means algorithm is a popular unsupervised learner for clustering samples.
44- ** Difficulty** : Easy
55- ** Training time** : Less than a minute
66
7- ## Requirements
8- - [ PHP] ( https://php.net ) 7.2 or above
9-
107## Installation
11- Clone the repository locally using [ Git ] ( https://git-scm.com / ) :
8+ Clone the project locally using [ Composer ] ( https://getcomposer.org / ) :
129``` sh
13- $ git clone https://github.com/RubixML/Colors
10+ $ composer create-project rubix/colors
1411```
1512
16- Install dependencies using [ Composer] ( https://getcomposer.org/ ) :
17- ``` sh
18- $ composer install
19- ```
13+ ## Requirements
14+ - [ PHP] ( https://php.net ) 7.2 or above
2015
2116## Tutorial
2217
@@ -34,15 +29,15 @@ use Rubix\ML\Datasets\Generators\Blob;
3429
3530$generator = new Agglomerate([
3631 'red' => new Blob([255, 0, 0], 20.0),
37- 'orange' => new Blob([255, 128, 0], 20 .0),
38- 'yellow' => new Blob([255, 255, 0], 20 .0),
32+ 'orange' => new Blob([255, 128, 0], 10 .0),
33+ 'yellow' => new Blob([255, 255, 0], 10 .0),
3934 'green' => new Blob([0, 128, 0], 20.0),
4035 'blue' => new Blob([0, 0, 255], 20.0),
41- 'aqua' => new Blob([0, 255, 255], 20 .0),
42- 'purple' => new Blob([128, 0, 255], 20 .0),
43- 'pink' => new Blob([255, 0, 255], 20 .0),
44- 'magenta' => new Blob([255, 0, 128], 20 .0),
45- 'black' => new Blob([0, 0, 0], 20 .0),
36+ 'aqua' => new Blob([0, 255, 255], 10 .0),
37+ 'purple' => new Blob([128, 0, 255], 10 .0),
38+ 'pink' => new Blob([255, 0, 255], 10 .0),
39+ 'magenta' => new Blob([255, 0, 128], 10 .0),
40+ 'black' => new Blob([0, 0, 0], 10 .0),
4641]);
4742```
4843
@@ -101,6 +96,11 @@ $report = new ContingencyTable();
10196$results = $report->generate($predictions, $testing->labels());
10297```
10398
99+ Now we're ready to run the training and validation script from the command line.
100+ ``` php
101+ $ php train.php
102+ ```
103+
104104Here is an excerpt of the Contingency Report. You'll notice a misclustered magenta point within the red cluster. Not bad, nice work!
105105
106106``` json
0 commit comments