Skip to content

Feat/adaptive stability thresholds - #293

Open
viktorbeck98 wants to merge 1 commit into
mainfrom
feat/adaptive-stability-thresholds
Open

Feat/adaptive stability thresholds#293
viktorbeck98 wants to merge 1 commit into
mainfrom
feat/adaptive-stability-thresholds

Conversation

@viktorbeck98

@viktorbeck98 viktorbeck98 commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Task

Description

Segment thresholds and the segment count become configurable instead of hardcoded.

ClassificationMethods gains a segment_thresholds: list[float] field (default
[1.1, 0.3, 0.1, 0.01] — the values that were hardcoded). The segment count is the
list's length, not a separate setting. StabilityClassifier keeps no thresholds of its
own: segment_threshs, n_segments and min_samples are read-only properties over the
block, so reassigning tracker.classification changes all three and a new verdict can be
taken from one ingest.

classify() gains a segment floor after STATIC/RANDOM: a variable with fewer
observations than segments returns INSUFFICIENT_DATA rather than a verdict scored over
empty segments (an empty segment means 0.0 and passes any positive threshold). This is the
only behavioural change at default settings, and it only applies when a segment method is
enabled — a slope-only block cuts no segments and is ungated.

Old snapshots still load: the block wins, a stale top-level segment_thresholds key is
picked up when the block has none, and pre-block state maps through segmentation /
require_declining / incline_threshold as before.

docs/detectors.md documents the field and the floor.

How Has This Been Tested?

45 new tests covering validation, the derived properties, block-swap re-derivation, the
segment-floor table, and each migration row. Full suite: 829 passed, 32 skipped, with the
7 pre-existing failures unchanged. All prek hooks pass, mypy included.

Checklist

  • This Pull-Request goes to the development branch.
  • I have successfully run prek locally.
  • I have added tests to cover my changes.
  • I have linked the issue-id to the task-description.
  • I have performed a self-review of my own code.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@viktorbeck98
viktorbeck98 requested a review from ipmach September 6, 2026 21:08
@viktorbeck98 viktorbeck98 self-assigned this Sep 6, 2026
@viktorbeck98
viktorbeck98 changed the base branch from main to development September 6, 2026 21:08
Base automatically changed from development to main September 7, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants