Exemplo n.º 1
0
 public function testRandomSplitCorrectSampleAndLabelPosition()
 {
     $dataset = new ArrayDataset($samples = [[1], [2], [3], [4]], $labels = [1, 2, 3, 4]);
     $randomSplit = new RandomSplit($dataset, 0.5);
     $this->assertEquals($randomSplit->getTestSamples()[0][0], $randomSplit->getTestLabels()[0]);
     $this->assertEquals($randomSplit->getTestSamples()[1][0], $randomSplit->getTestLabels()[1]);
     $this->assertEquals($randomSplit->getTrainSamples()[0][0], $randomSplit->getTrainLabels()[0]);
     $this->assertEquals($randomSplit->getTrainSamples()[1][0], $randomSplit->getTrainLabels()[1]);
 }