Skip to content

Add time_window parameter for temporal neighbor sampling#10652

Open
RishiBanerjee wants to merge 2 commits intopyg-team:masterfrom
RishiBanerjee:feature/time-window-temporal-sampling
Open

Add time_window parameter for temporal neighbor sampling#10652
RishiBanerjee wants to merge 2 commits intopyg-team:masterfrom
RishiBanerjee:feature/time-window-temporal-sampling

Conversation

@RishiBanerjee
Copy link
Copy Markdown

Introduces a time_window parameter to NeighborLoader and NeighborSampler that restricts neighbor sampling to a time window [input_time - time_window, input_time]. Implemented as a Python-side sentinel-masking pre-filter so it works with the existing pyg-lib and torch-sparse kernels without modification. Adds WITH_TIME_WINDOW_NEIGHBOR_SAMPLE capability flag in torch_geometric/typing.py for future native kernel support.

This is made to be a solution in pytorch-geometric to #10593

Introduces a `time_window` parameter to `NeighborLoader` and
`NeighborSampler` that restricts neighbor sampling to a time
window `[input_time - time_window, input_time]`. Implemented as
a Python-side sentinel-masking pre-filter so it works with the
existing pyg-lib and torch-sparse kernels without modification.
Adds `WITH_TIME_WINDOW_NEIGHBOR_SAMPLE` capability flag in
`torch_geometric/typing.py` for future native kernel support.
The batch-level approximation for time_window filtering becomes
inaccurate when seed times vary more than time_window within a batch.
Add a UserWarning in both homogeneous and heterogeneous paths, and
document the limitation in the NeighborSampler docstring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant