pytorch-forecasting
pytorch-forecasting copied to clipboard
Combined loss function using multiple targets
- PyTorch-Forecasting version: 0.10.2
- PyTorch version: 1.11.0
- Python version: 3.10.5
- Operating System: macOS 12.4
I have a multi-target regression problem where I currently use MAE loss for each of the targets.
model = LitFCMultiTargetModel.from_dataset(
train_dataset,
hidden_size=self.hidden_size,
n_hidden_layers=self.n_hidden_layers,
log_interval=1,
loss=MultiLoss(metrics=[MAE()] * len(self.targets)),
)
However, the targets are related to each other geometrically, i.e. they are x, y, z coordinates measured from a sensor. Therefore, I want to use the Euclidean distance between the predicted and target values as loss function instead of measuring the loss for each coordinate separately using MAE. Is there a way to create such a combined loss function?