mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-16 02:07:08 +00:00
653c7c772d
* upgrade to PHP 7.1 * bump travis and composer to PHP 7.1 * fix tests
27 lines
896 B
PHP
27 lines
896 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace tests\Phpml\Classification\DecisionTree;
|
|
|
|
use Phpml\Classification\DecisionTree\DecisionTreeLeaf;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class DecisionTreeLeafTest extends TestCase
|
|
{
|
|
public function testHTMLOutput(): void
|
|
{
|
|
$leaf = new DecisionTreeLeaf();
|
|
$leaf->value = 1;
|
|
$leaf->columnIndex = 0;
|
|
|
|
$rightLeaf = new DecisionTreeLeaf();
|
|
$rightLeaf->value = '<= 2';
|
|
$rightLeaf->columnIndex = 1;
|
|
|
|
$leaf->rightLeaf = $rightLeaf;
|
|
|
|
$this->assertEquals('<table ><tr><td colspan=3 align=center style=\'border:1px solid;\'><b>col_0 =1</b><br>Gini: 0.00</td></tr><tr><td></td><td> </td><td valign=top align=right><b>No |</b><br><table ><tr><td colspan=3 align=center style=\'border:1px solid;\'><b>col_1 <= 2</b><br>Gini: 0.00</td></tr></table></td></tr></table>', $leaf->getHTML());
|
|
}
|
|
}
|