Replies: 4 comments 2 replies
-
I think our current interface is a bit odd: We return aggregated and item metrics as a tuple. So something like this looks more modular: item_metrics = get_metrics(...)
agg_metrics = item_metrics.aggregate() I wonder, how do I as a user define which metrics are calculated? |
Beta Was this translation helpful? Give feedback.
-
I think the design proposal of @jaheba makes a lot of sense, as there is no need to couple both item and aggregated metrics. About the question of how do I as a user define which metrics are calculated? it seems to be possible as described here: One can pass which metrics to compute, what statistic to take as forecast, and what aggregation function to take for the computation of aggregated functions. Directly citing the above mentioned function:
On how one can pass a user define metric seems not clear at the moment, as mentioned by @mbohlkeschneider . About a |
Beta Was this translation helpful? Give feedback.
-
I think what we can do is to separate the definition of the metric and how it is used. Each metric consists of two steps:
For example,
class MSE:
def loss(self, target, forecast):
return np.square(target - forecast)
def aggregate(self, loss, axis=None):
return np.mean(loss, axis=axis) The nice thing about this approach is, that we can use the targets = [[...]]
forecasts = [[...]]
mse = MSE()
loss = mse.loss(targets, forecasts)
item_metric = mse.aggregate(loss, axis=1)
agg_metric = mse.aggregate(item_metric) Also, we can calculate the metric for each time-step, instead of each time-series: mse = MSE()
loss = mse.loss(targets, forecasts)
mse_by_time = mse.aggregate(loss, axis=0) |
Beta Was this translation helpful? Give feedback.
-
To improve efficiency, we could cache results of computation. As a trivial example, class Loss:
def get(self, x):
x.loss = x.target - x.forecast
class MSE:
requires = [Loss()]
def loss(self, x):
return np.square(x.loss)
... Another thing we might want to support is dependencies of metrics. For example Ideally, we can do this by writing something like: class RMSE:
dependencies = [MSE()]
def get(self, metrics):
return np.sqrt(metrics.mse) |
Beta Was this translation helpful? Give feedback.
-
Currently metric computations are basically done around
make_evaluations_predictions
and theEvaluator
as shown in this example:It would be useful to provide a way to compute the metrics without having to construct any predictor at all.
For instance: I have forecasts generated by GluonTS and they are in the typical json format, and I have my actuals, then how can I compute the metrics?
I first design idea would be to have a function to call that goes like this:
agg_metrics, item_metrics = compute_metrics(fcsts, actuals, freq)
To make this happen some of the related tasks would be:
SampleForecast
ListDataset
iteratorBeta Was this translation helpful? Give feedback.
All reactions