Skip to content

Commit

Permalink
Update README.md (#95)
Browse files Browse the repository at this point in the history
I tried copying the sample code as it is but did not do what I assumed.
Specifically, it is as follows.

- It does not work without `require_once`
- I can not check the output if it is `return`

I modified the README.md.
I think that this one is better.
Because you can use it as soon as you copy it.
  • Loading branch information
Hiroyuki Miura authored and akondas committed May 29, 2017
1 parent 2d3b44f commit 3bcba40
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ PHP-ML requires PHP >= 7.0.

Simple example of classification:
```php
require_once 'vendor/autoload.php';

use Phpml\Classification\KNearestNeighbors;

$samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]];
Expand All @@ -24,7 +26,7 @@ $labels = ['a', 'a', 'a', 'b', 'b', 'b'];
$classifier = new KNearestNeighbors();
$classifier->train($samples, $labels);

$classifier->predict([3, 2]);
echo $classifier->predict([3, 2]);
// return 'b'
```

Expand Down

0 comments on commit 3bcba40

Please sign in to comment.