Infer "auto" arguments from data - #136
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
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.
This PR define automatic values for
speed_priorandkernel_bandwidth, inferring them from data. It allows the user to leave them undefined and they will take on "sensible" (pinch of salt) values most of the time.IMPORTANTLY I tested it below on all datasets in
simple_demoand found the auto parameters gave decent performance (all gave positive change in BPS close to our "tuned" parameters). Nonetheless tuned parameters always did better and documentation is updated to warn against blindly using the auto values.Summary
kernel_bandwidthandspeed_priorto"auto", joining the existing automaticbin_sizedefault.kernel_bandwidth_,speed_prior_, andbin_size_, save them in result metadata, and label inferred values in the fit summary.fit/decodeterminology and aligned train/validation metrics.Automatic inference
bin_size="auto"uses 1/25 of the largest environment span:kernel_bandwidth="auto"uses the isotropic multivariate Scott estimate:bounded below by the grid resolution:
kernel_bandwidth_ = max(h, bin_size_).speed_prior="auto"uses mean behavioral speed:Angular displacements are wrapped to the shortest step before calculating speed. Explicit numeric values override inference, while
speed_prior=Nonecontinues to disable temporal smoothing.Motivation
Provide scale-aware defaults for minimal, out-of-the-box fitting without hiding modeling choices. Resolved values remain visible and reproducible, and users can set a larger speed prior when neural dynamics evolve faster than measured behavior.
Validation
ruff check src tests README.md examples/simpl_demo.ipynbpytestDemo comparison
scripts/compare_demo_auto_params.pyreruns the 1D and 2D models fromsimpl_demo.ipynbwith their explicitparameters and with automatic inference. Net validation bits per spike is the final value minus iteration 0;
the final column is auto minus current. HDC keeps its deliberately high
speed_prior=100. The 3D and 4Dhand-reaching models are omitted to avoid impractically large automatic grids.