dataset = $dataset; $this->estimator = $estimator; } /** * Perform a check of the specification and throw an exception if invalid. * * @throws InvalidArgumentException */ public function check() : void { switch ($this->estimator->type()) { case EstimatorType::classifier(): if ($this->dataset->labelType() != DataType::categorical()) { throw new InvalidArgumentException( 'Classifiers require categorical labels,' . " {$this->dataset->labelType()} given." ); } break; case EstimatorType::regressor(): if ($this->dataset->labelType() != DataType::continuous()) { throw new InvalidArgumentException( 'Regressors require continuous labels,' . " {$this->dataset->labelType()} given." ); } break; } } }