Class: FeatherAi::Consensus
- Inherits:
-
Object
- Object
- FeatherAi::Consensus
- Defined in:
- lib/feather_ai/consensus.rb
Overview
Multi-model consensus identification to improve accuracy. rubocop:disable Metrics/ClassLength
Instance Method Summary collapse
- #identify(image = nil, audio = nil, location: nil, tools: nil) ⇒ Object
-
#initialize(config: FeatherAi.configuration) ⇒ Consensus
constructor
A new instance of Consensus.
Constructor Details
#initialize(config: FeatherAi.configuration) ⇒ Consensus
Returns a new instance of Consensus.
7 8 9 10 |
# File 'lib/feather_ai/consensus.rb', line 7 def initialize(config: FeatherAi.configuration) @config = config @models = config.consensus_models end |
Instance Method Details
#identify(image = nil, audio = nil, location: nil, tools: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/feather_ai/consensus.rb', line 12 def identify(image = nil, audio = nil, location: nil, tools: nil) payload = { models: @models, location: location || @config.location } Instrumentation.instrument("consensus.feather_ai", payload) do results = fetch_results_from_models(image, audio, location, tools) shared_attrs = aggregate_metrics(results) result = build_consensus_result(results, shared_attrs) payload[:agreed] = result.confident? payload[:result] = result result end end |