Class: EncodingEstimator::Detection
- Inherits:
-
Object
- Object
- EncodingEstimator::Detection
- Defined in:
- lib/encoding_estimator/detection.rb
Overview
Class to represent the results of a detection process.
Instance Method Summary collapse
-
#initialize(scores, conversions) ⇒ Detection
constructor
Initialize a new object from the evaluation scores and the conversions tested.
-
#result ⇒ EncodingEstimator::Conversion
Get the most probable conversion.
-
#results ⇒ Array<Hash>
Get all conversions and their scores.
-
#score ⇒ Float
Get the score of the most probable conversion (-> the highest score).
Constructor Details
#initialize(scores, conversions) ⇒ Detection
Initialize a new object from the evaluation scores and the conversions tested
11 12 13 14 |
# File 'lib/encoding_estimator/detection.rb', line 11 def initialize( scores, conversions ) @scores = scores @conversions = conversions end |
Instance Method Details
#result ⇒ EncodingEstimator::Conversion
Get the most probable conversion
19 20 21 |
# File 'lib/encoding_estimator/detection.rb', line 19 def result @result ||= calculate_result end |
#results ⇒ Array<Hash>
Get all conversions and their scores
34 35 36 |
# File 'lib/encoding_estimator/detection.rb', line 34 def results @results ||= @conversions.map { |c| { conversion: c, score: @scores[ c.key ] } } end |
#score ⇒ Float
Get the score of the most probable conversion (-> the highest score)
26 27 28 |
# File 'lib/encoding_estimator/detection.rb', line 26 def score @scores[ result.key ] end |