nirs4all.visualization.chart_utils.normalizer module

ScoreNormalizer - Normalize scores for visualization.

class nirs4all.visualization.chart_utils.normalizer.ScoreNormalizer[source]

Bases: object

Normalize scores for visualization.

Handles normalization to [0, 1] range with support for both higher-is-better and lower-is-better metrics.

static is_higher_better(metric: str) bool[source]

Check if metric is higher-is-better.

Parameters:

metric – Metric name.

Returns:

True if higher is better, False otherwise.

static normalize(matrix: ndarray, higher_better: bool, per_row: bool = False, per_column: bool = False) ndarray[source]

Normalize matrix values to [0, 1] range.

Parameters:
  • matrix – Input matrix to normalize.

  • higher_better – Whether higher values are better.

  • per_row – If True, normalize each row independently.

  • per_column – If True, normalize each column independently. Takes precedence over per_row if both are True.

Returns:

Normalized matrix with values in [0, 1] range.