TorchSpatiotemporal / tsl

tsl: a PyTorch library for processing spatiotemporal data.
https://torch-spatiotemporal.readthedocs.io/
MIT License
236 stars 22 forks source link

Doubt about Masked Metric's init #20

Closed LucaButera closed 1 year ago

LucaButera commented 1 year ago

In tsl.metric.torch.metric_base.MaskedMetric.__init__ we have the following snippet

if metric_fn is None:
    self.metric_fn = None
else:
    self.metric_fn = partial(metric_fn, **metric_fn_kwargs)

Wouldn't this lead to a behavior in which we have an error thrown for passing metric_fn=None only upon computing the metric instead that having it thrown upon class construction? Is this a desired behavior?

marshka commented 1 year ago

Hi Luca,

yes, you're right, the metric function shouldn't be optional. We'll change this soon, thanks!