-
Notifications
You must be signed in to change notification settings - Fork 25
Missing reverse standardization in predict function #13
Copy link
Copy link
Open
Description
Hello author, I encountered an issue while using your model for time series prediction. In the predict function of exp_main.py, the original code does not reverse the standardization on the data (the default value for scale in dataloader.py is True) when generating the prediction results. This leads to some issues in the final generated results.
To fix this, I added a scale parameter in the execution script to control whether the data should be standardized or not. Additionally, I added the following code at line 366, which resulted in correct prediction results:
pred = outputs.detach().cpu().numpy() # .squeeze()
## if using scale
if self.args.scale:
pred_reshaped = pred.reshape(-1, pred.shape[-1])
# Apply inverse_transform using the saved scaler from Dataset_Pred
pred_reshaped = pred_loader.dataset.scaler.inverse_transform(pred_reshaped)
# Reshape back to original shape
pred = pred_reshaped.reshape(pred.shape) # (batch_size, pred_len, num_features)
preds.append(pred)Hopefully, it would be helpful. Thank you for your work on this model!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels