-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add stimulus downsampling #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
adds support for downsampling stimulus at time_units intervals during training and validation, allowing the model to learn dynamics without relying on fine-grained stimulus information. changes: - add StimulusFrequency enum with 4 modes: - ALL: use stimulus at every time step (default) - NONE: no stimulus (set to zero) - TIME_UNITS_CONSTANT: sample at tu intervals, hold constant - TIME_UNITS_INTERPOLATE: sample at tu intervals, linearly interpolate - add stimulus_frequency field to TrainingConfig with validation - implement downsample_stimulus() helper in latent.py - update train_step_nocompile to downsample encoded stimulus - update validation rollout functions (evolve_n_steps_activity and evolve_n_steps_latent) to support downsampling - rename evolve_n_steps -> evolve_n_steps_activity for clarity 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…s_utils moves the downsample_stimulus function to a new stimulus_utils.py module to avoid circular import between latent.py and diagnostics.py. changes: - create src/LatentEvolution/stimulus_utils.py with downsample_stimulus - update latent.py to import from stimulus_utils - update diagnostics.py to import from stimulus_utils - remove duplicate function definition from latent.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… point detects when total_steps doesn't include the final boundary point for interpolation and falls back to constant mode for the last interval. also fixes TIME_UNITS_CONSTANT mode to handle missing boundary points. changes: - TIME_UNITS_CONSTANT: calculate num_samples based on available data - TIME_UNITS_INTERPOLATE: detect edge case and use constant for last interval - both modes now work correctly when total_steps = num_multiples * tu 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
adds 14 unit tests covering all stimulus frequency modes and edge cases. tests verify correct behavior for ALL, NONE, TIME_UNITS_CONSTANT, and TIME_UNITS_INTERPOLATE modes, including edge cases with missing boundary points. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
moves unit tests from tests/ subdirectory to main module directory following project conventions. tests still pass with new location. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
changes TIME_UNITS_CONSTANT mode to use centered intervals around each sample point. stimulus at time t is now used for interval [t-tu/2, t+tu/2) instead of [t, t+tu). this provides better temporal alignment between the stimulus and the neural activity it's meant to represent. example with tu=20: - stimulus at t=0: used for steps [0, 10) - stimulus at t=20: used for steps [10, 30) - stimulus at t=40: used for steps [30, 50) changes: - update downsample_stimulus() to use centered intervals - update and add unit tests for centered interval behavior - fix dtype preservation in torch.zeros call 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
sets y-axis limits to (1e-3, 1.0) for better comparison across different runs and to prevent auto-scaling from hiding important differences in MSE values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
add pre-commit validation: - run ruff linting with proper exclusions and error messages - run unit tests using unittest discover with pattern *_test.py - execute checks in order: file sizes, ruff, then unit tests standardize test file naming: - rename test_chunk_loader.py to chunk_loader_test.py - follow convention: <module_name>_test.py for better IDE sorting update github actions: - comment out test job (tests now run in pre-commit hook) - keep ruff linting in CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
The goal here is to test whether we can maintain good performance if the stimulus is provided more sparsely.
We introduce a few different stimulus modes:
tuunits, but we hold the stimulus constant. For example, if the activity data is at 0, 20, 40, 60, .... for evolution at 10 < t < 30, we just repeat the stimulus at t=20.tuunits, but we linearly interpolateResults: we don't learn the correct rule and the roll out blows up.
Over the training window we don't see a blow up, but the MSE is pretty close to the linear interpolation baseline. But we blow up right outside the training window.
Also remove unit testing from github actions. Run unit tests locally via a precommit hook.