neuro_morpho.model.metrics

Evaluation metrics for model performance.

Attributes

PRED

LBL

METRIC_FN

Functions

accuracy(→ tuple[str, float])

Calculate the accuracy of predictions.

class_accuracy(→ tuple[str, float])

Calculate the class-wise accuracy of predictions.

Module Contents

neuro_morpho.model.metrics.PRED
neuro_morpho.model.metrics.LBL
neuro_morpho.model.metrics.METRIC_FN
neuro_morpho.model.metrics.accuracy(pred: PRED, lbl: LBL, threshold: float) tuple[str, float][source]

Calculate the accuracy of predictions.

Parameters:
  • pred (np.ndarray) – The predicted labels.

  • lbl (np.ndarray) – The true labels.

  • threshold (float) – The threshold for binary classification.

Returns:

A tuple containing the metric name and the accuracy value.

Return type:

tuple[str, float]

neuro_morpho.model.metrics.class_accuracy(pred: PRED, lbl: LBL, class_idx: int, threshold: float) tuple[str, float][source]

Calculate the class-wise accuracy of predictions.

Parameters:
  • pred (np.ndarray) – The predicted labels.

  • lbl (np.ndarray) – The true labels.

  • class_idx (int) – The class index to calculate accuracy for.

  • threshold (float) – The threshold for binary classification.

Returns:

A tuple containing the metric name and the class-wise accuracy value.

Return type:

tuple[str, float]