Skip to content

ltm: surface polarity confidence ratio for Rux/Bux classification #485

Closed

Description

@bpowers

Summary

LoopPolarity::from_runtime_scores in src/simlin-engine/src/ltm.rs collapses any sign change in the loop score to Undetermined. The reference paper instead retains a confidence ratio |r - |b|| / (r + |b|) and classifies loops as Rux (mostly reinforcing, briefly balancing) or Bux (mostly balancing, briefly reinforcing) when one polarity dominates. Simlin loses this distinction.

Locations

  • src/simlin-engine/src/ltm.rs:183-203 -- from_runtime_scores: (true, true) => Some(LoopPolarity::Undetermined)
  • src/simlin-engine/src/db_analysis.rs:880-889 -- DetectedLoop struct has polarity only, no confidence field
  • src/simlin-engine/src/db_analysis.rs:901-903 -- DetectedLoopsResult has only loops: Vec<DetectedLoop>

Suggested fix

  1. Compute the confidence ratio alongside the categorical polarity tally.
  2. Add a polarity_confidence: f64 field on DetectedLoop (range 0..=1).
  3. Add Rux / Bux variants (or a single MostlyReinforcing / MostlyBalancing with confidence) to LoopPolarity, with a documented threshold.
  4. Surface the confidence on the public DetectedLoopsResult so consumers (UI, reports) can render mixed-polarity loops without losing fidelity.

Severity

low (information-quality, not correctness)

References

Activity

  1. added
    enhancement
    engine
    ltm
    on May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineenhancementltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions