Class: DSPy::Teleprompt::MIPROv2::MIPROv2Config

Inherits:
Config
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dspy/teleprompt/mipro_v2.rb

Overview

Configuration for MIPROv2 optimization

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMIPROv2Config

Returns a new instance of MIPROv2Config.



96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 96

def initialize
  super
  @num_trials = 12
  @num_instruction_candidates = 5
  @bootstrap_sets = 5
  @optimization_strategy = "adaptive" # greedy, adaptive, bayesian
  @init_temperature = 1.0
  @final_temperature = 0.1
  @early_stopping_patience = 3
  @use_bayesian_optimization = true
  @track_diversity = true
  @proposer_config = DSPy::Propose::GroundedProposer::Config.new
end

Instance Attribute Details

#bootstrap_setsObject

Returns the value of attribute bootstrap_sets.



72
73
74
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 72

def bootstrap_sets
  @bootstrap_sets
end

#early_stopping_patienceObject

Returns the value of attribute early_stopping_patience.



84
85
86
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 84

def early_stopping_patience
  @early_stopping_patience
end

#final_temperatureObject

Returns the value of attribute final_temperature.



81
82
83
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 81

def final_temperature
  @final_temperature
end

#init_temperatureObject

Returns the value of attribute init_temperature.



78
79
80
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 78

def init_temperature
  @init_temperature
end

#num_instruction_candidatesObject

Returns the value of attribute num_instruction_candidates.



69
70
71
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 69

def num_instruction_candidates
  @num_instruction_candidates
end

#num_trialsObject

Returns the value of attribute num_trials.



66
67
68
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 66

def num_trials
  @num_trials
end

#optimization_strategyObject

Returns the value of attribute optimization_strategy.



75
76
77
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 75

def optimization_strategy
  @optimization_strategy
end

#proposer_configObject

Returns the value of attribute proposer_config.



93
94
95
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 93

def proposer_config
  @proposer_config
end

#track_diversityObject

Returns the value of attribute track_diversity.



90
91
92
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 90

def track_diversity
  @track_diversity
end

#use_bayesian_optimizationObject

Returns the value of attribute use_bayesian_optimization.



87
88
89
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 87

def use_bayesian_optimization
  @use_bayesian_optimization
end

Instance Method Details

#to_hObject



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 111

def to_h
  super.merge({
    num_trials: @num_trials,
    num_instruction_candidates: @num_instruction_candidates,
    bootstrap_sets: @bootstrap_sets,
    optimization_strategy: @optimization_strategy,
    init_temperature: @init_temperature,
    final_temperature: @final_temperature,
    early_stopping_patience: @early_stopping_patience,
    use_bayesian_optimization: @use_bayesian_optimization,
    track_diversity: @track_diversity
  })
end