mean); } /** * Fit the guessing strategy to a set of values. * * @internal * @param list $values * @throws InvalidArgumentException */ public function fit(array $values) : void { if (empty($values)) { throw new InvalidArgumentException('Strategy must be' . ' fitted to at least 1 value.'); } $this->mean = Stats::mean($values); } /** * Make a continuous guess. * * @internal * * @throws RuntimeException * @return float */ public function guess() : float { if ($this->mean === null) { throw new RuntimeException('Strategy has not been fitted.'); } return $this->mean; } /** * Return the string representation of the object. * * @internal * * @return string */ public function __toString() : string { return 'Mean'; } }