Class: DSPy::Teleprompt::Utils::BootstrapResult
- Inherits:
-
Object
- Object
- DSPy::Teleprompt::Utils::BootstrapResult
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/teleprompt/utils.rb
Overview
Result of bootstrap operation
Instance Attribute Summary collapse
-
#candidate_sets ⇒ Object
readonly
Returns the value of attribute candidate_sets.
-
#failed_examples ⇒ Object
readonly
Returns the value of attribute failed_examples.
-
#statistics ⇒ Object
readonly
Returns the value of attribute statistics.
-
#successful_examples ⇒ Object
readonly
Returns the value of attribute successful_examples.
Instance Method Summary collapse
-
#initialize(candidate_sets:, successful_examples:, failed_examples:, statistics:) ⇒ BootstrapResult
constructor
A new instance of BootstrapResult.
- #success_rate ⇒ Object
- #total_examples ⇒ Object
Constructor Details
#initialize(candidate_sets:, successful_examples:, failed_examples:, statistics:) ⇒ BootstrapResult
Returns a new instance of BootstrapResult.
76 77 78 79 80 81 |
# File 'lib/dspy/teleprompt/utils.rb', line 76 def initialize(candidate_sets:, successful_examples:, failed_examples:, statistics:) @candidate_sets = candidate_sets.freeze @successful_examples = successful_examples.freeze @failed_examples = failed_examples.freeze @statistics = statistics.freeze end |
Instance Attribute Details
#candidate_sets ⇒ Object (readonly)
Returns the value of attribute candidate_sets.
57 58 59 |
# File 'lib/dspy/teleprompt/utils.rb', line 57 def candidate_sets @candidate_sets end |
#failed_examples ⇒ Object (readonly)
Returns the value of attribute failed_examples.
63 64 65 |
# File 'lib/dspy/teleprompt/utils.rb', line 63 def failed_examples @failed_examples end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
66 67 68 |
# File 'lib/dspy/teleprompt/utils.rb', line 66 def statistics @statistics end |
#successful_examples ⇒ Object (readonly)
Returns the value of attribute successful_examples.
60 61 62 |
# File 'lib/dspy/teleprompt/utils.rb', line 60 def successful_examples @successful_examples end |
Instance Method Details
#success_rate ⇒ Object
84 85 86 87 88 |
# File 'lib/dspy/teleprompt/utils.rb', line 84 def success_rate total = @successful_examples.size + @failed_examples.size return 0.0 if total == 0 @successful_examples.size.to_f / total.to_f end |
#total_examples ⇒ Object
91 92 93 |
# File 'lib/dspy/teleprompt/utils.rb', line 91 def total_examples @successful_examples.size + @failed_examples.size end |