vote_best_index

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

vote_best_index(scores_by_method: Mapping[str, Sequence[float]], methods: Sequence[str]) → int[source]

Combine several validation scores into one cluster-count choice.

A single method decides on its own. Several methods each cast one vote for their own best candidate; the candidate with the most votes wins and ties are broken toward the smallest index, so a tie prefers the more parsimonious model.

Parameters:
  • scores_by_method – Validation score name -> score per candidate.

  • methods – Names to consider, all of which must be present in scores_by_method.

Returns:

Index of the selected candidate.

Raises:

ValueError – If methods is empty or names a score that was not computed.