pytorch-forecasting icon indicating copy to clipboard operation
pytorch-forecasting copied to clipboard

Allow for different weights for different targets

Open gaobhub opened this issue 11 months ago • 4 comments

Can you please make the TimeSeriesDataSet to accept a list of weights for each corresponding to a target?

gaobhub avatar Mar 06 '25 22:03 gaobhub

I would second this and also ask to be able to send additional information to the loss function. Something like a flag whether a value is censured on the upside or downside. This would enable Tobit model style loss functions which for specific data points reduce penalty for over/under forecasting if for example sales were artificially constrained.

mkuiack avatar Mar 07 '25 09:03 mkuiack

@gaobhub, @mkuiack, what would be much appreciated is a snippet of example code where you pass weights per target.

This would be passed as part of the TimeSeriesDataSet, right?

@phoeenniixx, is this already supported in your v2 redesign, or would this be easy to add? Not necessary in the first full prototype, but I was just thinking how we could easily support the "weights overall" and "weights per variable" cases both.

fkiraly avatar Mar 09 '25 07:03 fkiraly

@phoeenniixx, is this already supported in your v2 redesign, or would this be easy to add? Not necessary in the first full prototype, but I was just thinking how we could easily support the "weights overall" and "weights per variable" cases both.

Well for now I have not added these functionality, but it would be really good to have! I will read about it and would try to incorporate this in my design (Not necessarily in next iteration, but maybe in the subsequent ones)

phoeenniixx avatar Mar 09 '25 17:03 phoeenniixx

@gaobhub, @mkuiack, what would be much appreciated is a snippet of example code where you pass weights per target.

This would be passed as part of the TimeSeriesDataSet, right?

@phoeenniixx, is this already supported in your v2 redesign, or would this be easy to add? Not necessary in the first full prototype, but I was just thinking how we could easily support the "weights overall" and "weights per variable" cases both.

Yes, it is in TimeSeriesDataSet. Currently in TimeSeriesDataSet, the weight vector is shared by all targets if it is multi-target. I would suggest to make the weight the same dimension with targets for a multi-target case to allow for one weight corresponding to one target.

gaobhub avatar Mar 09 '25 21:03 gaobhub