Skip to content

Commit 20fb26c

Browse files
committed
Update to version 0.1.0
1 parent 7232de4 commit 20fb26c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
],
2121
"require": {
2222
"php": ">=7.2",
23-
"league/csv": "^9.5",
24-
"rubix/ml": "^0.1.0-rc3"
23+
"rubix/ml": "^0.1.0"
2524
},
2625
"scripts": {
2726
"train": "@php train.php"

train.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Rubix\ML\Other\Loggers\Screen;
99
use Rubix\ML\CrossValidation\Reports\ContingencyTable;
1010
use Rubix\ML\CrossValidation\Metrics\Homogeneity;
11-
use League\Csv\Writer;
11+
use Rubix\ML\Datasets\Unlabeled;
1212

1313
use function Rubix\ML\array_transpose;
1414

@@ -31,18 +31,17 @@
3131

3232
$estimator = new KMeans(10);
3333

34-
$estimator->setLogger(new Screen('colors'));
34+
$estimator->setLogger(new Screen());
3535

3636
echo 'Training ...' . PHP_EOL;
3737

3838
$estimator->train($training);
3939

4040
$losses = $estimator->steps();
4141

42-
$writer = Writer::createFromPath('progress.csv', 'w+');
43-
44-
$writer->insertOne(['loss']);
45-
$writer->insertAll(array_transpose([$losses]));
42+
Unlabeled::build(array_transpose([$losses]))
43+
->toCSV(['losses'])
44+
->write('progress.csv');
4645

4746
echo 'Progress saved to progress.csv' . PHP_EOL;
4847

@@ -54,7 +53,9 @@
5453

5554
$results = $report->generate($predictions, $testing->labels());
5655

57-
file_put_contents('report.json', json_encode($results, JSON_PRETTY_PRINT));
56+
echo $results;
57+
58+
$results->toJSON()->write('report.json');
5859

5960
echo 'Report saved to report.json' . PHP_EOL;
6061

0 commit comments

Comments
 (0)