Skip to content

Commit

Permalink
Add embedding script
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Mar 6, 2022
1 parent 3e4cc69 commit 5472285
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/vendor
composer.lock
report.json
embedding.csv
*.model
.vscode
.vs
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"rubix/ml": "^1.0"
},
"scripts": {
"explore": "@php explore.php",
"train": "@php train.php",
"simulate": "@php simulate.php"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions explore.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

include __DIR__ . '/vendor/autoload.php';

use Rubix\ML\Loggers\Screen;
use Rubix\ML\Datasets\Labeled;
use Rubix\ML\Extractors\NDJSON;
use Rubix\ML\Transformers\PrincipalComponentAnalysis;
use Rubix\ML\Extractors\CSV;

ini_set('memory_limit', '-1');

$logger = new Screen();

$logger->info('Loading data into memory');

$dataset = Labeled::fromIterator(new NDJSON('dataset.ndjson'));

$embedder = new PrincipalComponentAnalysis(2);

$dataset->apply($embedder)->exportTo(new CSV('embedding.csv'));

$logger->info('Embedding saved to embedding.csv');

0 comments on commit 5472285

Please sign in to comment.