check(); if ($degree < 1) { throw new InvalidArgumentException('Degree must be greater than 0,' . " $degree given."); } $this->degree = $degree; $this->gamma = $gamma; $this->coef0 = $coef0; } /** * Return the options for the libsvm runtime. * * @internal * * @return mixed[] */ public function options() : array { return [ svm::OPT_KERNEL_TYPE => svm::KERNEL_POLY, svm::OPT_DEGREE => $this->degree, svm::OPT_GAMMA => $this->gamma, svm::OPT_COEF_ZERO => $this->coef0, ]; } /** * Return the string representation of the object. * * @internal * * @return string */ public function __toString() : string { return "Polynomial (degree: {$this->degree}, gamma: {$this->gamma}, coef0: {$this->coef0})"; } }