Generalise SpacetimeEncoder, freeze the EPJ-C variant - #920
Open
sevmag wants to merge 1 commit into
Open
Conversation
sevmag
force-pushed
the
feature/spacetime-encoder-config
branch
from
September 9, 2026 22:08
4f28f66 to
63e6a34
Compare
The spacetime encoder hardcoded the Kaggle dataset's normalisation: position in columns 0-2 and time in column 3, the constant converting time into a length, the multiplier setting the resolved band, and the clip. On other data those choices are silently wrong -- a mismatched time constant reduces the interval to a spatial distance. Keep the shipped behaviour as SpacetimeEncoderEPJC and add a general SpacetimeEncoder taking columns, time_scale, scale, clip and n_freq, mirroring the FourierEncoder split. IceMix uses the EPJC variant, so its output is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F75gXoxTcs4nVRxGp91ENf
sevmag
force-pushed
the
feature/spacetime-encoder-config
branch
from
September 11, 2026 15:27
63e6a34 to
dbc9960
Compare
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.
Generalises
SpacetimeEncoderso it can be used on detectors other than the one it was written for, keeping the published version unchanged under a new name — the same treatment #913 givesFourierEncoder.SpacetimeEncoderhardcodes four properties of the Kaggle dataset's normalisation: position in columns 0-2 and time in column 3; the constant3e4 / 500 * 3e-1converting time into a length; the1024multiplier and ladder span that set which separations the embedding resolves; and the ±4 clip.Changing numerical ranges in the feature standardization or for different detectors requires a configurable time weighting in the difference.
Changes
SpacetimeEncoderEPJC— the existing class, unchanged, with its assumptions documented.IceMix/DeepIceuse it, so their output is bit-for-bit what it was.SpacetimeEncoder— the same computation withcolumns,time_scale,scale,clip,n_freqandoutput_dimsupplied by the caller; the defaults reproduce the EPJC band.signed_four_distance()— the interval lifted out so both classes share one implementation.SinusoidalPosEmb.n_freqwidened frominttofloat, since a matched span is generally not an integer, and its docstring corrected: it sets the ladder's span, not the number of frequencies (that isdim / 2).Verified against a pinned copy of the pre-refactor class: the EPJC path, the configurable path at EPJC settings, and a column-permuted input all reproduce the original embedding exactly (
max|d| = 0). Pre-commit clean.