MCPcopy Create free account
hub / github.com/Eladlev/AutoPrompt / stop_criteria

Method stop_criteria

optimization_pipeline.py:148–166  ·  view source on GitHub ↗

Check if the stop criteria holds. The conditions for stopping: 1. Usage is above the threshold 2. There was no improvement in the last > patient steps

(self)

Source from the content-addressed store, hash-verified

146 self.cur_prompt = prompt_suggestion['prompt']
147
148 def stop_criteria(self):
149 """
150 Check if the stop criteria holds. The conditions for stopping:
151 1. Usage is above the threshold
152 2. There was no improvement in the last > patient steps
153 """
154 if 0 < self.config.stop_criteria.max_usage < self.calc_usage():
155 return True
156 if len(self.eval.history) <= self.config.meta_prompts.warmup:
157 self.patient = 0
158 return False
159 min_batch_id, max_score = self.eval.get_max_score(self.config.meta_prompts.warmup-1)
160 if max_score - self.eval.history[-1]['score'] > -self.config.stop_criteria.min_delta:
161 self.patient += 1
162 else:
163 self.patient = 0
164 if self.patient > self.config.stop_criteria.patience:
165 return True
166 return False
167
168 @staticmethod
169 def generate_samples_batch(batch_input, num_samples, batch_size):

Callers 1

stepMethod · 0.95

Calls 2

calc_usageMethod · 0.95
get_max_scoreMethod · 0.80

Tested by

no test coverage detected