Class: DSPy::Evaluate::BatchEvaluationResult
- Inherits:
-
Object
- Object
- DSPy::Evaluate::BatchEvaluationResult
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/evaluate.rb
Overview
Batch evaluation results with aggregated metrics
Instance Attribute Summary collapse
-
#aggregated_metrics ⇒ Object
readonly
Returns the value of attribute aggregated_metrics.
-
#pass_rate ⇒ Object
readonly
Returns the value of attribute pass_rate.
-
#passed_examples ⇒ Object
readonly
Returns the value of attribute passed_examples.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#total_examples ⇒ Object
readonly
Returns the value of attribute total_examples.
Instance Method Summary collapse
-
#initialize(results:, aggregated_metrics:) ⇒ BatchEvaluationResult
constructor
A new instance of BatchEvaluationResult.
- #to_h ⇒ Object
Constructor Details
#initialize(results:, aggregated_metrics:) ⇒ BatchEvaluationResult
Returns a new instance of BatchEvaluationResult.
85 86 87 88 89 90 91 |
# File 'lib/dspy/evaluate.rb', line 85 def initialize(results:, aggregated_metrics:) @results = results.freeze @aggregated_metrics = aggregated_metrics.freeze @total_examples = results.length @passed_examples = results.count(&:passed) @pass_rate = @total_examples > 0 ? @passed_examples.to_f / @total_examples : 0.0 end |
Instance Attribute Details
#aggregated_metrics ⇒ Object (readonly)
Returns the value of attribute aggregated_metrics.
68 69 70 |
# File 'lib/dspy/evaluate.rb', line 68 def aggregated_metrics @aggregated_metrics end |
#pass_rate ⇒ Object (readonly)
Returns the value of attribute pass_rate.
77 78 79 |
# File 'lib/dspy/evaluate.rb', line 77 def pass_rate @pass_rate end |
#passed_examples ⇒ Object (readonly)
Returns the value of attribute passed_examples.
74 75 76 |
# File 'lib/dspy/evaluate.rb', line 74 def passed_examples @passed_examples end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
65 66 67 |
# File 'lib/dspy/evaluate.rb', line 65 def results @results end |
#total_examples ⇒ Object (readonly)
Returns the value of attribute total_examples.
71 72 73 |
# File 'lib/dspy/evaluate.rb', line 71 def total_examples @total_examples end |
Instance Method Details
#to_h ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/dspy/evaluate.rb', line 94 def to_h { total_examples: @total_examples, passed_examples: @passed_examples, pass_rate: @pass_rate, aggregated_metrics: @aggregated_metrics, results: @results.map(&:to_h) } end |