You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(val_X.shape) # samples (n_samples) in train set and val set are different, but they have the same sequence len (n_steps) and feature dim (n_features)
281
+
print(f"We have {calc_missing_rate(train_X):.1%} values missing in train_X")
282
+
train_set = {"X": train_X} # in training set, simply put the incomplete time series into it
283
+
val_set = {
284
+
"X": val_X,
285
+
"X_ori": data["val_X_ori"], # in validation set, we need ground truth for evaluation and picking the best model checkpoint
286
+
}
287
+
test_set = {"X": test_X} # in test set, only give the testing incomplete time series for model to impute
288
+
test_X_ori = data["test_X_ori"] # test_X_ori bears ground truth for evaluation
289
+
indicating_mask = np.isnan(test_X) ^ np.isnan(test_X_ori) # mask indicates the values that are missing in X but not in X_ori, i.e. where the gt values are
290
+
291
+
from pypots.imputation importSAITS# import the model you want to use
saits.fit(train_set, val_set) # train the model on the dataset
295
+
imputation = saits.impute(test_set) # impute the originally-missing values and artificially-missing values
296
+
mae = calc_mae(imputation, np.nan_to_num(test_X_ori), indicating_mask) # calculate mean absolute error on the ground truth (artificially-missing values)
296
297
saits.save("save_it_here/saits_physionet2012.pypots") # save the model for future use
297
298
saits.load("save_it_here/saits_physionet2012.pypots") # reload the serialized model file for following imputation or training
298
299
```
@@ -519,18 +520,21 @@ Time-Series.AI</a>
519
520
[^41]: Xu, Z., Zeng, A., & Xu, Q. (2024).
520
521
[FITS: Modeling Time Series with 10k parameters](https://openreview.net/forum?id=bWcnvZ3qMb).
521
522
*ICLR 2024*.
522
-
[^42]: Qian, L., Ibrahim, Z., Ellis, H. L., Zhang, A., Zhang, Y., Wang, T., & Dobson, R. (2023).
523
+
[^42]: Qian, L., Ibrahim, Z., Ellis, H. L., Zhang, A., Zhang, Y., Wang, T., & Dobson, R. (2023).
523
524
[Knowledge Enhanced Conditional Imputation for Healthcare Time-series](https://arxiv.org/abs/2312.16713).
524
525
*arXiv 2023*.
525
-
[^43]: Lin, S., Lin, W., Wu, W., Zhao, F., Mo, R., & Zhang, H. (2023).
526
+
[^43]: Lin, S., Lin, W., Wu, W., Zhao, F., Mo, R., & Zhang, H. (2023).
526
527
[SegRNN: Segment Recurrent Neural Network for Long-Term Time Series Forecasting](https://arxiv.org/abs/2308.11200).
527
528
*arXiv 2023*.
528
-
[^44]: Yu, H. F., Rao, N., & Dhillon, I. S. (2016).
529
+
[^44]: Yu, H. F., Rao, N., & Dhillon, I. S. (2016).
529
530
[Temporal regularized matrix factorization for high-dimensional time series prediction](https://papers.nips.cc/paper_files/paper/2016/hash/85422afb467e9456013a2a51d4dff702-Abstract.html).
530
531
*NeurIPS 2016*.
531
-
[^45]: Jin, M., Wang, S., Ma, L., Chu, Z., Zhang, J. Y., Shi, X., ... & Wen, Q. (2024).
532
+
[^45]: Jin, M., Wang, S., Ma, L., Chu, Z., Zhang, J. Y., Shi, X., ... & Wen, Q. (2024).
532
533
[Time-LLM: Time Series Forecasting by Reprogramming Large Language Models](https://openreview.net/forum?id=Unb5CVPtae).
0 commit comments