php-ml/tests/Phpml/Classification/Ensemble/RandomForestTest.php
Tomáš Votruba f4650c696c [coding standard] fix imports order and drop unused docs typehints (#145)
* fix imports order

* drop unused docs typehints, make use of return types where possible
2017-11-06 08:56:37 +01:00

37 lines
891 B
PHP

<?php
declare(strict_types=1);
namespace tests\Phpml\Classification\Ensemble;
use Phpml\Classification\DecisionTree;
use Phpml\Classification\Ensemble\RandomForest;
use Phpml\Classification\NaiveBayes;
class RandomForestTest extends BaggingTest
{
protected function getClassifier($numBaseClassifiers = 50)
{
$classifier = new RandomForest($numBaseClassifiers);
$classifier->setFeatureSubsetRatio('log');
return $classifier;
}
protected function getAvailableBaseClassifiers()
{
return [DecisionTree::class => ['depth' => 5]];
}
public function testOtherBaseClassifier()
{
try {
$classifier = new RandomForest();
$classifier->setClassifer(NaiveBayes::class);
$this->assertEquals(0, 1);
} catch (\Exception $ex) {
$this->assertEquals(1, 1);
}
}
}