physioex.train.metrics#

Functions

accuracy_score(outputs, targets[, ...])

Compute accuracy score.

cohen_kappa_score(outputs, targets[, ...])

confusion_matrix(outputs, targets[, ...])

f1_score(outputs, targets[, ignore_index, ...])

Compute F1 score.

mae_score(outputs, targets[, ignore_index])

Mean absolute error for regression tasks.

mse_score(outputs, targets[, ignore_index])

Mean squared error for regression tasks.

precision_score(outputs, targets[, ...])

Compute precision score.

r2_score(outputs, targets[, ignore_index])

Coefficient of determination (R^2) for regression tasks.

recall_score(outputs, targets[, ...])

Compute recall score.

support_score(outputs, targets[, ignore_index])

physioex.train.metrics.accuracy_score(outputs, targets, ignore_index=-1, average='micro')[source]#

Compute accuracy score.

Parameters:
  • outputs (Tensor) – Model outputs (logits), shape (…, n_classes).

  • targets (Tensor) – Ground-truth labels.

  • ignore_index (int) – Label value to ignore (default -1).

  • average (str) – Averaging method. "micro" computes global accuracy (correct / total). "weighted" is equivalent to "micro" for accuracy and is accepted for API consistency with the other metric functions.

Returns:

Accuracy as a float in [0, 1].

Return type:

float

physioex.train.metrics.f1_score(outputs, targets, ignore_index=-1, average='macro')[source]#

Compute F1 score.

Parameters:
  • outputs (Tensor) – Model outputs (logits), shape (…, n_classes).

  • targets (Tensor) – Ground-truth labels.

  • ignore_index (int) – Label value to ignore (default -1).

  • average (str) – "macro" returns unweighted mean of per-class F1 across classes with non-zero support. "weighted" weights each class F1 by its support (number of true instances).

Returns:

F1 score as a float in [0, 1].

Return type:

float

physioex.train.metrics.mae_score(outputs, targets, ignore_index=-1)[source]#

Mean absolute error for regression tasks.

Parameters:
Return type:

float

physioex.train.metrics.mse_score(outputs, targets, ignore_index=-1)[source]#

Mean squared error for regression tasks.

Parameters:
Return type:

float

physioex.train.metrics.precision_score(outputs, targets, ignore_index=-1, average='macro')[source]#

Compute precision score.

Parameters:
  • outputs (Tensor) – Model outputs (logits), shape (…, n_classes).

  • targets (Tensor) – Ground-truth labels.

  • ignore_index (int) – Label value to ignore (default -1).

  • average (str) – "macro" returns unweighted mean of per-class precision across classes with non-zero support. "weighted" weights each class precision by its support.

Returns:

Precision as a float in [0, 1].

Return type:

float

physioex.train.metrics.r2_score(outputs, targets, ignore_index=-1)[source]#

Coefficient of determination (R^2) for regression tasks.

Parameters:
Return type:

float

physioex.train.metrics.recall_score(outputs, targets, ignore_index=-1, average='macro')[source]#

Compute recall score.

Parameters:
  • outputs (Tensor) – Model outputs (logits), shape (…, n_classes).

  • targets (Tensor) – Ground-truth labels.

  • ignore_index (int) – Label value to ignore (default -1).

  • average (str) – "macro" returns unweighted mean of per-class recall across classes with non-zero support. "weighted" weights each class recall by its support.

Returns:

Recall as a float in [0, 1].

Return type:

float