metrics
canari_ml.models.metrics
¶
canari_ml.models.metrics.BaseMetric(leadtimes_to_evaluate=None)
¶
Bases: Metric
Base class for all metrics.
Reference: https://lightning.ai/docs/torchmetrics/stable/pages/implement.html
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leadtimes_to_evaluate
|
list
|
A list of leadtimes to consider e.g., [0, 1, 2, 3, 4, 5] to consider first n days/months (i.e. leadtime) in accuracy computation e.g., [0] to only look at the first day's accuracy e.g., [5] to only look at the sixth day's accuracy |
None
|
Source code in src/canari_ml/models/metrics.py
canari_ml.models.metrics.BaseMetric.leadtimes_to_evaluate = leadtimes_to_evaluate if leadtimes_to_evaluate is not None else slice(None)
instance-attribute
¶
canari_ml.models.metrics.MAE(*args, **kwargs)
¶
Bases: BaseMetric
Weighted MAE metric for use at multiple leadtimes.
Source code in src/canari_ml/models/metrics.py
canari_ml.models.metrics.MAE.update(predictions, targets, sample_weight, **kwargs)
¶
Update state with predictions and targets.
Source code in src/canari_ml/models/metrics.py
canari_ml.models.metrics.MSE(*args, **kwargs)
¶
Bases: BaseMetric
Weighted MSE metric for use at multiple leadtimes.
Source code in src/canari_ml/models/metrics.py
canari_ml.models.metrics.MSE.update(predictions, targets, sample_weight, **kwargs)
¶
Update state with predictions and targets.