lrr cluster by field#14
Merged
Merged
Conversation
_hash_message runs on every message. Folding the whole channel-axis field's bytes is O(channels) and scales with channel count on the hot path. Fold only an O(1) boolean for whether the axis carries the target structured field, matching the ezmsg-sigproc CommonRereference hash this mirrors (which moved to a presence boolean). Concession: a change in the field's *values* while the axis stays structured and the channel count is unchanged is no longer detected -- safe for real acquisition streams, whose channel->field map is static for the stream's life; a genuine remap arrives with a new key or channel count, both already in the hash. Invert the re-derive test accordingly: it now asserts the live-remap value change is deliberately NOT re-derived, and that a new key (the escape hatch) forces re-derivation.
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.
Summary
LRR can now derive its per-bank regression blocks from a structured channel-axis
field instead of relying on positional
block_size.cluster_by_fieldtoSelfSupervisedRegressionSettings(inherited byLRR). When set (e.g.
"bank") and no explicitchannel_clustersare given,clusters are derived from that field via
ezmsg.sigproc.util.channels.channel_clusters_from_field, cached at_reset_state(so the message-less_get_channel_clusters— also calledexternally — can return them).
channel_clusters>cluster_by_field>block_size_hash_messagefolds the field's bytes into the hash so derived clustersre-derive when the field changes (mirrors the sigproc fix).
Tests
TestClusterByFieldintest_ssr.py: bank-derived weights byte-identical toexplicit per-bank
channel_clusters, explicit-clusters precedence, fallback toblock_size, and re-derive on bank change. 21 pass.car-bank-awarePRfirst.
pyproject.tomlcurrently pinsezmsg-sigprocto thecar-bank-awarebranchin
[tool.uv.sources]for local testing.