Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.
This repository was archived by the owner on May 1, 2025. It is now read-only.

def __getitem__(self, idx: int) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: #17

Open
@YHU11

Description

@YHU11
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

123

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions