getData($this->data); $classifier = new DecisionTree(5); $classifier->train($data, $targets); $this->assertEquals('Dont_play', $classifier->predict(['sunny', 78, 72, 'false'])); $this->assertEquals('Play', $classifier->predict(['overcast', 60, 60, 'false'])); $this->assertEquals('Dont_play', $classifier->predict(['rain', 60, 60, 'true'])); list($data, $targets) = $this->getData($this->extraData); $classifier->train($data, $targets); $this->assertEquals('Dont_play', $classifier->predict(['scorching', 95, 90, 'true'])); $this->assertEquals('Play', $classifier->predict(['overcast', 60, 60, 'false'])); return $classifier; } public function testTreeDepth() { list($data, $targets) = $this->getData($this->data); $classifier = new DecisionTree(5); $classifier->train($data, $targets); $this->assertTrue(5 >= $classifier->actualDepth); } }