Spaces:
Running
Running
File size: 762 Bytes
4c41a36 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from typing import Dict
import torch
from torchmetrics import functional as FM
def regression_metrics(preds: torch.Tensor,
target: torch.Tensor) -> Dict[str, torch.Tensor]:
"""
get_classification_metrics
Return some metrics evaluation the classification task
Parameters
----------
preds : torch.Tensor
logits, probs
target : torch.Tensor
targets label
Returns
-------
Dict[str, torch.Tensor]
_description_
"""
mse: torch.Tensor = FM.mean_squared_error(preds=preds, target=target)
mape: torch.Tensor = FM.mean_absolute_percentage_error(preds=preds,
target=target)
return dict(mse=mse, mape=mape)
|