Skip to content

Commit

Permalink
Added composer installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Jun 18, 2020
1 parent 7bfe4a3 commit 30997eb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ The K Means algorithm is a popular unsupervised learner for clustering samples.
- **Difficulty**: Easy
- **Training time**: Less than a minute

## Requirements
- [PHP](https://php.net) 7.2 or above

## Installation
Clone the repository locally using [Git](https://git-scm.com/):
Clone the project locally using [Composer](https://getcomposer.org/):
```sh
$ git clone https://github.com/RubixML/Colors
$ composer create-project rubix/colors
```

Install dependencies using [Composer](https://getcomposer.org/):
```sh
$ composer install
```
## Requirements
- [PHP](https://php.net) 7.2 or above

## Tutorial

Expand All @@ -34,15 +29,15 @@ use Rubix\ML\Datasets\Generators\Blob;

$generator = new Agglomerate([
'red' => new Blob([255, 0, 0], 20.0),
'orange' => new Blob([255, 128, 0], 20.0),
'yellow' => new Blob([255, 255, 0], 20.0),
'orange' => new Blob([255, 128, 0], 10.0),
'yellow' => new Blob([255, 255, 0], 10.0),
'green' => new Blob([0, 128, 0], 20.0),
'blue' => new Blob([0, 0, 255], 20.0),
'aqua' => new Blob([0, 255, 255], 20.0),
'purple' => new Blob([128, 0, 255], 20.0),
'pink' => new Blob([255, 0, 255], 20.0),
'magenta' => new Blob([255, 0, 128], 20.0),
'black' => new Blob([0, 0, 0], 20.0),
'aqua' => new Blob([0, 255, 255], 10.0),
'purple' => new Blob([128, 0, 255], 10.0),
'pink' => new Blob([255, 0, 255], 10.0),
'magenta' => new Blob([255, 0, 128], 10.0),
'black' => new Blob([0, 0, 0], 10.0),
]);
```

Expand Down Expand Up @@ -101,6 +96,11 @@ $report = new ContingencyTable();
$results = $report->generate($predictions, $testing->labels());
```

Now we're ready to run the training and validation script from the command line.
```php
$ php train.php
```

Here is an excerpt of the Contingency Report. You'll notice a misclustered magenta point within the red cluster. Not bad, nice work!

```json
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
"league/csv": "^9.5",
"rubix/ml": "^0.1.0-rc3"
},
"scripts": {
"train": "@php train.php"
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

0 comments on commit 30997eb

Please sign in to comment.