*/ public function compatibility() : array { return [ EstimatorType::clusterer(), ]; } /** * Score a set of predictions. * * @param list $predictions * @param list $labels * @return float */ public function score(array $predictions, array $labels) : float { $table = (new ContingencyTable())->generate($labels, $predictions); $score = 0.0; foreach ($table as $dist) { $score += max($dist) / (array_sum($dist) ?: EPSILON); } return $score / count($table); } /** * Return the string representation of the object. * * @internal * * @return string */ public function __toString() : string { return 'Completeness'; } }