Module: Legion::Gaia::BehavioralSynapse::Math
- Defined in:
- lib/legion/gaia/behavioral_synapse.rb
Overview
Vendored confidence math — identical constants to Legion::Extensions::Synapse::Helpers::Confidence. At runtime we delegate to the real module if it is loaded.
Constant Summary collapse
- STARTING_SCORES =
{ explicit: 0.7, emergent: 0.3, seeded: 0.5 }.freeze
- ADJUSTMENTS =
{ success: 0.02, failure: -0.05, validation_failure: -0.03, consecutive_bonus: 0.05 }.freeze
- DECAY_RATE =
0.998- CONSECUTIVE_BONUS_THRESHOLD =
50- AUTONOMY_RANGES =
{ observe: 0.0..0.3, filter: 0.3..0.6, transform: 0.6..0.8, autonomous: 0.8..1.0 }.freeze
- E_WEIGHT =
3.0
Class Method Summary collapse
- .adjust(confidence, event, consecutive_successes: 0) ⇒ Object
- .autonomy_mode(confidence) ⇒ Object
- .decay(confidence, hours: 1) ⇒ Object
- .starting_score(origin) ⇒ Object
Class Method Details
.adjust(confidence, event, consecutive_successes: 0) ⇒ Object
41 42 43 44 45 |
# File 'lib/legion/gaia/behavioral_synapse.rb', line 41 def adjust(confidence, event, consecutive_successes: 0) delta = ADJUSTMENTS.fetch(event.to_sym, 0.0) delta += ADJUSTMENTS[:consecutive_bonus] if consecutive_successes >= CONSECUTIVE_BONUS_THRESHOLD (confidence + delta).clamp(0.0, 1.0) end |
.autonomy_mode(confidence) ⇒ Object
51 52 53 |
# File 'lib/legion/gaia/behavioral_synapse.rb', line 51 def autonomy_mode(confidence) AUTONOMY_RANGES.find { |_mode, range| range.cover?(confidence) }&.first || :observe end |
.decay(confidence, hours: 1) ⇒ Object
47 48 49 |
# File 'lib/legion/gaia/behavioral_synapse.rb', line 47 def decay(confidence, hours: 1) (confidence * (DECAY_RATE**hours)).clamp(0.0, 1.0) end |
.starting_score(origin) ⇒ Object
37 38 39 |
# File 'lib/legion/gaia/behavioral_synapse.rb', line 37 def starting_score(origin) STARTING_SCORES.fetch(origin.to_sym, 0.3) end |