Non-Ordered TGB Timestamp Remap - #69
Merged
Merged
Conversation
Jacob-Chmura
marked this pull request as ready for review
June 26, 2025 14:44
shenyangHuang
left a comment
Collaborator
There was a problem hiding this comment.
to discuss at meeting
| custom_td = TimeDeltaDG('s') | ||
| mock_td = {'tgbn-foo': TimeDeltaDG('Y')} | ||
| with patch.dict('tgm.timedelta.TGB_TIME_DELTAS', mock_td): | ||
| data = DGData.from_tgb(name='tgbn-foo', time_delta=custom_td, split=split) |
Collaborator
There was a problem hiding this comment.
so here we overwrite the default time delta from tgb
Collaborator
There was a problem hiding this comment.
this basically behaves like temporal coarsening? the timestamps would be remapped? might be good to chat about this
|
|
||
| # TODO: int conversion may need some thought | ||
| time_factor = int(tgb_time_delta.convert(time_delta)) | ||
| timestamps *= time_factor |
Collaborator
There was a problem hiding this comment.
the timestamps will become float after this point?
timestamps should always be integers if possible.
let's discuss this
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
shenyangHuang
approved these changes
Jul 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
The purpose of this PR is to add the logic for remapping temporal timestamps when the user specifies a non-ordered time delta type that conflicts with tgb-native time units.
For simplicity, I have forwarded the custom
time_deltadirectly intoDGData.from_any()so that future data sources (e.g. #35) can re-use this logic without pollutingkwargsdict.Key Changes
DGraphconstructor. We forward the argument and handle all conversions inDGDatabefore initializing the storageDGData.from_any()explicitly takes an optional customtime_deltawhich is used to remap timestamps in the appropriate class constructor (currently only TGB)DGraph.time_deltaa private attribute with a getter to make it clear that the user should not set a new time_delta on the graph (this won't reflect an update in the storage and hence is a bad state).Things to keep in mind
We throw a ValueError when trying to coarsen a graph. This requires either merging events (Time Coarsening Skeleton #67) and/or having float-timestamps with is currently not expected behaviour. We should revisit this to ensure it is not necessary.
Relevant Prs
Close #40
Out of scope