Class: Legion::Extensions::Agentic::Attention::FeatureBinding::Helpers::Feature
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::FeatureBinding::Helpers::Feature
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb
Constant Summary
Constants included from Constants
Constants::ATTENTION_BOOST, Constants::BINDING_ALPHA, Constants::BINDING_CONFIRMATION_THRESHOLD, Constants::BINDING_DECAY, Constants::BINDING_STATE_LABELS, Constants::BINDING_STRENGTH_FLOOR, Constants::DEFAULT_BINDING_STRENGTH, Constants::FEATURE_DIMENSIONS, Constants::FEATURE_SALIENCE_FLOOR, Constants::ILLUSORY_CONJUNCTION_THRESHOLD, Constants::MAX_BINDINGS, Constants::MAX_BINDING_HISTORY, Constants::MAX_FEATURES, Constants::MAX_OBJECTS, Constants::STRENGTH_LABELS
Instance Attribute Summary collapse
-
#detected_at ⇒ Object
readonly
Returns the value of attribute detected_at.
-
#dimension ⇒ Object
readonly
Returns the value of attribute dimension.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#salience ⇒ Object
Returns the value of attribute salience.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #decay ⇒ Object
- #faded? ⇒ Boolean
-
#initialize(id:, dimension:, value:, source: :perception, salience: 0.5) ⇒ Feature
constructor
A new instance of Feature.
- #salient? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(id:, dimension:, value:, source: :perception, salience: 0.5) ⇒ Feature
Returns a new instance of Feature.
15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 15 def initialize(id:, dimension:, value:, source: :perception, salience: 0.5) @id = id @dimension = dimension @value = value @source = source @salience = salience.to_f.clamp(0.0, 1.0) @detected_at = Time.now.utc end |
Instance Attribute Details
#detected_at ⇒ Object (readonly)
Returns the value of attribute detected_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 12 def detected_at @detected_at end |
#dimension ⇒ Object (readonly)
Returns the value of attribute dimension.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 12 def dimension @dimension end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 12 def id @id end |
#salience ⇒ Object
Returns the value of attribute salience.
13 14 15 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 13 def salience @salience end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 12 def source @source end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 12 def value @value end |
Instance Method Details
#decay ⇒ Object
28 29 30 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 28 def decay @salience = [@salience - BINDING_DECAY, 0.0].max end |
#faded? ⇒ Boolean
32 33 34 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 32 def faded? @salience <= FEATURE_SALIENCE_FLOOR end |
#salient? ⇒ Boolean
24 25 26 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 24 def salient? @salience > FEATURE_SALIENCE_FLOOR end |
#to_h ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/helpers/feature.rb', line 36 def to_h { id: @id, dimension: @dimension, value: @value, source: @source, salience: @salience.round(4), detected_at: @detected_at } end |