1 | <?php |
||
9 | class Imputer implements Preprocessor |
||
10 | { |
||
11 | const AXIS_COLUMN = 0; |
||
12 | const AXIS_ROW = 1; |
||
13 | |||
14 | /** |
||
15 | * @var mixed |
||
16 | */ |
||
17 | private $missingValue; |
||
18 | |||
19 | /** |
||
20 | * @var Strategy |
||
21 | */ |
||
22 | private $strategy; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | private $axis; |
||
28 | |||
29 | /** |
||
30 | * @var |
||
31 | */ |
||
32 | private $samples; |
||
33 | |||
34 | /** |
||
35 | * @param mixed $missingValue |
||
36 | * @param Strategy $strategy |
||
37 | * @param int $axis |
||
38 | * @param array|null $samples |
||
39 | */ |
||
40 | public function __construct($missingValue = null, Strategy $strategy, int $axis = self::AXIS_COLUMN, array $samples = []) |
||
47 | |||
48 | /** |
||
49 | * @param array $samples |
||
50 | */ |
||
51 | public function fit(array $samples) |
||
55 | |||
56 | /** |
||
57 | * @param array $samples |
||
58 | */ |
||
59 | public function transform(array &$samples) |
||
65 | |||
66 | /** |
||
67 | * @param array $sample |
||
68 | */ |
||
69 | private function preprocessSample(array &$sample) |
||
77 | |||
78 | /** |
||
79 | * @param int $column |
||
80 | * @param array $currentSample |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | private function getAxis(int $column, array $currentSample): array |
||
99 | } |
||
100 |