DeepTime
DeepTime copied to clipboard
def __getitem__(self, idx: int) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
def __getitem__(self, idx: int) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
if self.time_features:
dim_idx = idx // self.n_time_samples
dim_slice = slice(dim_idx, dim_idx + 1)
idx = idx % self.n_time_samples
else:
dim_slice = slice(None)
x_start = idx
x_end = x_start + self.lookback_len
y_start = x_end - self.lookback_aux_len
y_end = y_start + self.lookback_aux_len + self.horizon_len
x = self.data_x[x_start:x_end, dim_slice]
y = self.data_y[y_start:y_end, dim_slice]
x_time = self.timestamps[x_start:x_end]
y_time = self.timestamps[y_start:y_end]
return x, y, x_time, y_time
Hello, thank you for sharing the code. I would like to ask why this place retrieves data in this way