Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
7 / 7 |
| ArrayDataset | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
7 / 7 |
| __construct | |
100.00% |
1 / 1 |
2 | |
100.00% |
5 / 5 |
|||
| getSamples | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getLabels | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| declare (strict_types = 1); | |
| namespace Phpml\Dataset; | |
| use Phpml\Exception\InvalidArgumentException; | |
| class ArrayDataset implements Dataset | |
| { | |
| /** | |
| * @var array | |
| */ | |
| protected $samples = []; | |
| /** | |
| * @var array | |
| */ | |
| protected $labels = []; | |
| /** | |
| * @param array $samples | |
| * @param array $labels | |
| * | |
| * @throws InvalidArgumentException | |
| */ | |
| public function __construct(array $samples, array $labels) | |
| { | |
| if (count($samples) != count($labels)) { | |
| throw InvalidArgumentException::arraySizeNotMatch(); | |
| } | |
| $this->samples = $samples; | |
| $this->labels = $labels; | |
| } | |
| /** | |
| * @return array | |
| */ | |
| public function getSamples(): array | |
| { | |
| return $this->samples; | |
| } | |
| /** | |
| * @return array | |
| */ | |
| public function getLabels(): array | |
| { | |
| return $this->labels; | |
| } | |
| } |