@@ -4,19 +4,14 @@ The K Means algorithm is a popular unsupervised learner for clustering samples.
4
4
- ** Difficulty** : Easy
5
5
- ** Training time** : Less than a minute
6
6
7
- ## Requirements
8
- - [ PHP] ( https://php.net ) 7.2 or above
9
-
10
7
## Installation
11
- Clone the repository locally using [ Git ] ( https://git-scm.com / ) :
8
+ Clone the project locally using [ Composer ] ( https://getcomposer.org / ) :
12
9
``` sh
13
- $ git clone https://github.com/RubixML/Colors
10
+ $ composer create-project rubix/colors
14
11
```
15
12
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
20
15
21
16
## Tutorial
22
17
@@ -34,15 +29,15 @@ use Rubix\ML\Datasets\Generators\Blob;
34
29
35
30
$generator = new Agglomerate([
36
31
'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),
39
34
'green' => new Blob([0, 128, 0], 20.0),
40
35
'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),
46
41
]);
47
42
```
48
43
@@ -101,6 +96,11 @@ $report = new ContingencyTable();
101
96
$results = $report->generate($predictions, $testing->labels());
102
97
```
103
98
99
+ Now we're ready to run the training and validation script from the command line.
100
+ ``` php
101
+ $ php train.php
102
+ ```
103
+
104
104
Here is an excerpt of the Contingency Report. You'll notice a misclustered magenta point within the red cluster. Not bad, nice work!
105
105
106
106
``` json
0 commit comments