plot_cluster_validation_curves

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.

plot_cluster_validation_curves(scores: Mapping[str, Sequence[float]], cluster_range: Sequence[int], *, selected: int | Mapping[str, int] | None = None, methods: Sequence[str] | None = None, directions: Mapping[str, str] | None = None, title: str | None = None) → Figure[source]

Plot auto-K / cluster-validation score curves (one panel per method).

Parameters:
  • scores – Method name → score sequence aligned with cluster_range.

  • cluster_range – Candidate habitat counts (x-axis), ascending.

  • selected – Global selected k, or per-method best k to mark.

  • methods – Subset / order of methods; default is scores key order.

  • directions – Optional method -> {"maximize","minimize","knee"}; used only when selected is a single int and a mark must be recomputed for a method missing from a mapping.

  • title – Optional figure title (ASCII-sanitised).

Returns:

A matplotlib Figure.

Raises:

HABITAPIError – On empty inputs or length mismatches.