-
-
Notifications
You must be signed in to change notification settings - Fork 654
Closed
Description
🚀 Feature
Currently, if we have custom metrics that require data other then y_pred
and y
, we suggest to do the following:
metrics = {
"Accuracy": Accuracy(),
"Loss": Loss(criterion, output_transform=lambda out_dict: (out_dict["y_pred"], out_dict["y"])),
"CustomMetric": CustomMetric()
}
evaluator = create_supervised_evaluator(
model,
metrics=metrics,
output_transform=lambda x, y, y_pred: {"x": x, "y": y, "y_pred": y_pred}
)
where CustomMetric
is defined as
class CustomMetric(Metric):
required_output_keys = ("y_pred", "y", "x")
The idea is to extend this for Loss
metric to support required_output_keys
. The main issue with Loss
now is with (prediction, target, kwargs)
optional input, where kwargs
is a dict for extra args for criterion function.
sdesrozis