| 1 | <?php |
||
| 10 | abstract class Split |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $trainSamples = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | protected $testSamples = []; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array |
||
| 24 | */ |
||
| 25 | protected $trainLabels = []; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var array |
||
| 29 | */ |
||
| 30 | protected $testLabels = []; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param Dataset $dataset |
||
| 34 | * @param float $testSize |
||
| 35 | * @param int $seed |
||
| 36 | * |
||
| 37 | * @throws InvalidArgumentException |
||
| 38 | */ |
||
| 39 | public function __construct(Dataset $dataset, float $testSize = 0.3, int $seed = null) |
||
| 48 | |||
| 49 | abstract protected function splitDataset(Dataset $dataset, float $testSize); |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return array |
||
| 53 | */ |
||
| 54 | public function getTrainSamples() |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return array |
||
| 61 | */ |
||
| 62 | public function getTestSamples() |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return array |
||
| 69 | */ |
||
| 70 | public function getTrainLabels() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return array |
||
| 77 | */ |
||
| 78 | public function getTestLabels() |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @param int|null $seed |
||
| 85 | */ |
||
| 86 | protected function seedGenerator(int $seed = null) |
||
| 94 | } |
||
| 95 |