Skip to content

Commit

Permalink
Update to Rubix ML 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Aug 7, 2020
1 parent 11dd0b6 commit 9875fa8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"require": {
"php": ">=7.2",
"ext-gd": "*",
"league/csv": "^9.5",
"rubix/ml": "0.1.0-rc3"
"rubix/ml": "^0.1.0"
},
"suggest": {
"ext-tensor": "For faster training and inference"
Expand Down
10 changes: 5 additions & 5 deletions train.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Rubix\ML\NeuralNet\Optimizers\Adam;
use Rubix\ML\Persisters\Filesystem;
use Rubix\ML\Other\Loggers\Screen;
use League\Csv\Writer;
use Rubix\ML\Datasets\Unlabeled;

use function Rubix\ML\array_transpose;

Expand Down Expand Up @@ -57,7 +57,7 @@
new Filesystem('cifar-10.model', true)
);

$estimator->setLogger(new Screen('CIFAR10'));
$estimator->setLogger(new Screen());

echo 'Training ...' . PHP_EOL;

Expand All @@ -66,9 +66,9 @@
$scores = $estimator->scores();
$losses = $estimator->steps();

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

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

Expand Down
4 changes: 3 additions & 1 deletion validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

$results = $report->generate($predictions, $dataset->labels());

file_put_contents('report.json', json_encode($results, JSON_PRETTY_PRINT));
echo $results;

$results->toJSON()->write('report.json');

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

0 comments on commit 9875fa8

Please sign in to comment.