dataset = $dataset; $this->kernel = $kernel; } /** * Perform a check of the specification and throw an exception if invalid. * * @throws \Rubix\ML\Exceptions\InvalidArgumentException */ public function check() : void { $compatibility = $this->kernel->compatibility(); $types = $this->dataset->uniqueTypes(); $compatible = array_intersect($types, $compatibility); if (count($compatible) < count($types)) { $incompatible = array_diff($types, $compatibility); throw new InvalidArgumentException( "{$this->kernel} is incompatible with " . implode(', ', $incompatible) . ' data types.' ); } } }