Adding a BinomialDistributionLoss to TemporalFusionTransformer

Hi all (maybe a basic question) but I would like to construct a BinomialDistributionLoss() for my TemporalFusionTransformer

But such a loss requires both the output of the network and the total_counts.

I can provide the total_counts (and do) within the TimeSeriesDataSet via the time_varying_known_reals variable, but how can I access that value in the loss?

Does the dataloader return each covariate and could I pass it in?

Thanks!

If you can access this attribute in the Dataset, you could return it in the __getitem__ which will also make sure the DataLoader returns it. Inside the training loop you could then pass it to your loss function.

1 Like