physioex.train.metrics#
Functions
|
Compute accuracy score. |
|
|
|
|
|
Compute F1 score. |
|
Mean absolute error for regression tasks. |
|
Mean squared error for regression tasks. |
|
Compute precision score. |
|
Coefficient of determination (R^2) for regression tasks. |
|
Compute recall score. |
|
- 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:
- 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:
- physioex.train.metrics.mae_score(outputs, targets, ignore_index=-1)[source]#
Mean absolute error for regression tasks.
- physioex.train.metrics.mse_score(outputs, targets, ignore_index=-1)[source]#
Mean squared error for regression tasks.
- 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:
- physioex.train.metrics.r2_score(outputs, targets, ignore_index=-1)[source]#
Coefficient of determination (R^2) for regression tasks.
- 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: