(self, root_path, win_size, step=100, flag="train")
| 504 | |
| 505 | class SMDSegLoader(Dataset): |
| 506 | def __init__(self, root_path, win_size, step=100, flag="train"): |
| 507 | self.flag = flag |
| 508 | self.step = step |
| 509 | self.win_size = win_size |
| 510 | self.scaler = StandardScaler() |
| 511 | data = np.load(os.path.join(root_path, "SMD_train.npy")) |
| 512 | self.scaler.fit(data) |
| 513 | data = self.scaler.transform(data) |
| 514 | test_data = np.load(os.path.join(root_path, "SMD_test.npy")) |
| 515 | self.test = self.scaler.transform(test_data) |
| 516 | self.train = data |
| 517 | data_len = len(self.train) |
| 518 | self.val = self.train[(int)(data_len * 0.8):] |
| 519 | self.test_labels = np.load(os.path.join(root_path, "SMD_test_label.npy")) |
| 520 | |
| 521 | def __len__(self): |
| 522 | if self.flag == "train": |
nothing calls this directly
no test coverage detected