Fix/value range detector keyerror#234
Open
viktorbeck98 wants to merge 5 commits into
Open
Conversation
Add a time_dependent config that cuts StabilityClassifier segments at equal-duration boundaries of the observed time span instead of equal-count boundaries of the change series. - StabilityClassifier.is_stable gains optional timestamps; boundaries via np.searchsorted on equal-duration cuts, count-mode fallback on missing/mismatched/non-finite timestamps or zero span (never raises) - SingleStabilityTracker(time_dependent=...) stores exact per-occurrence timestamps; state round-trips via msgpack, legacy snapshots load - timestamp threaded EventPersistency.ingest_event -> add_data -> add_value as optional trailing param; dataframe backends accept+ignore - EventStabilityTracker(time_dependent=...) forwards via closure factory (survives load(), mirroring expand_value) Default off is bit-for-bit unchanged. 17 new tests; full suite 550 pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
cast_val_to_numeric used a hard configured_variables[k] lookup, but in the detection path k comes from variables learned during training. For variable-length events, the current line can legitimately lack that variable (get_configured_variables skips positions beyond the line's variable count), raising KeyError. The detect loop already intends to skip absent vars via .get() and `value is None`, but the crash happened first. Guard the lookup so the helper is consistent with that contract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Task
#233
Description
KeyError on variable-length events: cast_val_to_numeric did a hard configured_variables[k] lookup for training-learned vars that the current line may lack → added if k not in configured_variables: return False so the detector skips them instead of crashing.
How Has This Been Tested?
Checklist