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.

best_index(scores: Sequence[float], direction: str) → int[source]

Return the index of the best score under the given selection rule.

Parameters:
  • scores – Score per candidate cluster count, in ascending count order.

  • direction – MAXIMIZE, MINIMIZE, KNEE or BIC_GRADIENT.

Returns:

Index into scores of the selected candidate.

Raises:

ValueError – If scores is empty.