2016-04-07 20:36:02 +00:00
|
|
|
<?php
|
|
|
|
|
2016-11-20 21:53:17 +00:00
|
|
|
declare(strict_types=1);
|
2016-04-07 20:36:02 +00:00
|
|
|
|
|
|
|
namespace tests\Phpml\Dataset;
|
|
|
|
|
|
|
|
use Phpml\Dataset\ArrayDataset;
|
2017-02-03 11:58:25 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-04-07 20:36:02 +00:00
|
|
|
|
2017-02-03 11:58:25 +00:00
|
|
|
class ArrayDatasetTest extends TestCase
|
2016-04-07 20:36:02 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @expectedException \Phpml\Exception\InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function testThrowExceptionOnInvalidArgumentsSize()
|
|
|
|
{
|
|
|
|
new ArrayDataset([0, 1], [0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testArrayDataset()
|
|
|
|
{
|
|
|
|
$dataset = new ArrayDataset(
|
|
|
|
$samples = [[1], [2], [3], [4]],
|
|
|
|
$labels = ['a', 'a', 'b', 'b']
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertEquals($samples, $dataset->getSamples());
|
2016-06-16 21:56:15 +00:00
|
|
|
$this->assertEquals($labels, $dataset->getTargets());
|
2016-04-07 20:36:02 +00:00
|
|
|
}
|
|
|
|
}
|