1. Go to this page and download the library: Download rubix/dota2 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rubix / dota2 example snippets
ubix\ML\Extractors\CSV;
use Rubix\ML\Datasets\Labeled;
use Rubix\ML\PersistentModel;
use Rubix\ML\Classifiers\NaiveBayes;
use Rubix\ML\Persisters\Filesystem;
ini_set('memory_limit', '-1');
echo 'Loading data into memory ...' . PHP_EOL;
$dataset = Labeled::fromIterator(new CSV('train.csv', true));
$estimator = new PersistentModel(new NaiveBayes(), new Filesystem('dota.rbx'));
echo 'Training ...' . PHP_EOL;
$estimator->train($dataset);
if (strtolower(readline('Save this model? (y|[n]): ')) === 'y') {
$estimator->save();
}
new PersistentModel(new NaiveBayes(), new Filesystem('dota.rbx'));
ubix\ML\Extractors\CSV;
use Rubix\ML\Datasets\Labeled;
use Rubix\ML\PersistentModel;
use Rubix\ML\Persisters\Filesystem;
use Rubix\ML\CrossValidation\Reports\AggregateReport;
use Rubix\ML\CrossValidation\Reports\ConfusionMatrix;
use Rubix\ML\CrossValidation\Reports\MulticlassBreakdown;
ini_set('memory_limit', '-1');
echo 'Loading data into memory ...' . PHP_EOL;
$dataset = Labeled::fromIterator(new CSV('test.csv', true));
$estimator = PersistentModel::load(new Filesystem('dota.rbx'));
echo 'Making predictions ...' . PHP_EOL;
$predictions = $estimator->predict($dataset);
$report = new AggregateReport([
new MulticlassBreakdown(),
new ConfusionMatrix(),
]);
$results = $report->generate($predictions, $dataset->labels());
echo $results;
$results->toJSON()->saveTo(new Filesystem('report.json'));
echo 'Report saved to report.json' . PHP_EOL;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.