-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathAgglomerateTest.php
66 lines (56 loc) · 1.48 KB
/
AgglomerateTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
namespace Rubix\ML\Tests\Datasets\Generators;
use Rubix\ML\Datasets\Dataset;
use Rubix\ML\Datasets\Labeled;
use Rubix\ML\Datasets\Generators\Blob;
use Rubix\ML\Datasets\Generators\Generator;
use Rubix\ML\Datasets\Generators\Agglomerate;
use PHPUnit\Framework\TestCase;
/**
* @group Generators
* @covers \Rubix\ML\Datasets\Generators\Agglomerate
*/
class AgglomerateTest extends TestCase
{
protected const DATASET_SIZE = 30;
/**
* @var Agglomerate
*/
protected $generator;
/**
* @before
*/
protected function setUp() : void
{
$this->generator = new Agglomerate([
'one' => new Blob([-5.0, 3.0], 0.2),
'two' => new Blob([5.0, -3.0], 0.2),
], [1, 0.5]);
}
/**
* @test
*/
public function build() : void
{
$this->assertInstanceOf(Agglomerate::class, $this->generator);
$this->assertInstanceOf(Generator::class, $this->generator);
}
/**
* @test
*/
public function dimensions() : void
{
$this->assertEquals(2, $this->generator->dimensions());
}
/**
* @test
*/
public function generate() : void
{
$dataset = $this->generator->generate(self::DATASET_SIZE);
$this->assertInstanceOf(Labeled::class, $dataset);
$this->assertInstanceOf(Dataset::class, $dataset);
$this->assertCount(self::DATASET_SIZE, $dataset);
$this->assertEquals(['one', 'two'], $dataset->possibleOutcomes());
}
}