Class: DSPy::Teleprompt::Utils::BootstrapResult Deprecated
- Inherits:
-
Object
- Object
- DSPy::Teleprompt::Utils::BootstrapResult
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/teleprompt/utils.rb
Overview
Deprecated.
This class is deprecated and kept only for backward compatibility. The new create_n_fewshot_demo_sets returns a Hash=> [[demos]] instead of this BootstrapResult object. Use the dict interface directly.
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.
181 182 183 184 185 186 |
# File 'lib/dspy/teleprompt/utils.rb', line 181 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.
162 163 164 |
# File 'lib/dspy/teleprompt/utils.rb', line 162 def candidate_sets @candidate_sets end |
#failed_examples ⇒ Object (readonly)
Returns the value of attribute failed_examples.
168 169 170 |
# File 'lib/dspy/teleprompt/utils.rb', line 168 def failed_examples @failed_examples end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
171 172 173 |
# File 'lib/dspy/teleprompt/utils.rb', line 171 def statistics @statistics end |
#successful_examples ⇒ Object (readonly)
Returns the value of attribute successful_examples.
165 166 167 |
# File 'lib/dspy/teleprompt/utils.rb', line 165 def successful_examples @successful_examples end |
Instance Method Details
#success_rate ⇒ Object
189 190 191 192 193 |
# File 'lib/dspy/teleprompt/utils.rb', line 189 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
196 197 198 |
# File 'lib/dspy/teleprompt/utils.rb', line 196 def total_examples @successful_examples.size + @failed_examples.size end |