Inheritance: extends Split
示例#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]);
 }
示例#2
0
 /**
  * @param Dataset $dataset
  * @param float   $testSize
  */
 protected function splitDataset(Dataset $dataset, float $testSize)
 {
     $datasets = $this->splitByTarget($dataset);
     foreach ($datasets as $targetSet) {
         parent::splitDataset($targetSet, $testSize);
     }
 }