Total Complexity | 8 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class ArrayDataset implements Dataset |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $samples = []; |
||
15 | |||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $targets = []; |
||
20 | |||
21 | /** |
||
22 | * @throws InvalidArgumentException |
||
23 | */ |
||
24 | public function __construct(array $samples, array $targets) |
||
25 | { |
||
26 | if (count($samples) !== count($targets)) { |
||
27 | throw new InvalidArgumentException('Size of given arrays does not match'); |
||
28 | } |
||
29 | |||
30 | $this->samples = $samples; |
||
31 | $this->targets = $targets; |
||
32 | } |
||
33 | |||
34 | public function getSamples(): array |
||
35 | { |
||
36 | return $this->samples; |
||
37 | } |
||
38 | |||
39 | public function getTargets(): array |
||
40 | { |
||
41 | return $this->targets; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param int[] $columns |
||
46 | */ |
||
47 | public function removeColumns(array $columns): void |
||
48 | { |
||
49 | foreach ($this->samples as &$sample) { |
||
50 | $this->removeColumnsFromSample($sample, $columns); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | private function removeColumnsFromSample(array &$sample, array $columns): void |
||
61 | } |
||
62 | } |
||
63 |