node = new VantagePoint(self::CENTER, self::RADIUS, $groups); } /** * @test */ public function build() : void { $this->assertInstanceOf(VantagePoint::class, $this->node); $this->assertInstanceOf(Hypersphere::class, $this->node); $this->assertInstanceOf(BinaryNode::class, $this->node); $this->assertInstanceOf(Node::class, $this->node); } /** * @test */ public function split() : void { $dataset = Labeled::quick(self::SAMPLES, self::LABELS); $node = VantagePoint::split($dataset, new Euclidean()); $this->assertEquals(self::CENTER, $node->center()); $this->assertEquals(self::RADIUS, $node->radius()); } /** * @test */ public function center() : void { $this->assertSame(self::CENTER, $this->node->center()); } /** * @test */ public function radius() : void { $this->assertSame(self::RADIUS, $this->node->radius()); } /** * @test */ public function subsets() : void { $expected = [ Labeled::quick([self::SAMPLES[0]], [self::LABELS[0]]), Labeled::quick([self::SAMPLES[1]], [self::LABELS[1]]), ]; $this->assertEquals($expected, $this->node->subsets()); } }