MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / run_config

Function run_config

scripts/holdout_param_sweep.py:199–251  ·  view source on GitHub ↗
(config: ExperimentConfig)

Source from the content-addressed store, hash-verified

197 }
198
199 def run_config(config: ExperimentConfig) -> dict[str, Any]:
200 original_low_threshold = ensemble_mod._LOW_ESCALATION_THRESHOLD
201 ensemble_mod._LOW_ESCALATION_THRESHOLD = config.low_escalation_threshold
202 ensemble_2sig = Ensemble(
203 weights=[config.weights_a, config.weights_c],
204 risk_tolerance=0.5,
205 calibrator=calibrator,
206 )
207 ensemble_3sig = Ensemble(
208 weights=list(THREE_SIGNAL_WEIGHTS),
209 risk_tolerance=0.5,
210 calibrator=calibrator,
211 )
212
213 def predict(row: dict[str, Any]) -> int:
214 row_id = row["id"]
215 vote_a = vote_a_by_id[row_id]
216 vote_c = vote_c_by_threshold[config.classifier_fallback_threshold][row_id]
217
218 if config.signal_b_conditional and len(row.get("messages", [])) >= 4:
219 vote_b = vote_b_by_id[row_id]
220 result = ensemble_3sig.decide([vote_a, vote_b, vote_c])
221 else:
222 result = ensemble_2sig.decide([vote_a, vote_c])
223
224 return 1 if result.tier_id is None else result.tier_id
225
226 try:
227 predictor = FunctionPredictor(predict)
228 per_row, errors, correct = evaluate_question_bank_rows(
229 predictor,
230 rows,
231 predictor_label=_config_name(config),
232 )
233 summary = build_eval_summary(
234 per_row=per_row,
235 errors=errors,
236 correct=correct,
237 predictor_label=_config_name(config),
238 shard=split_path,
239 sample_mode=f"{split}_split",
240 seed=42,
241 proportional_quotas=None,
242 benchmark_counts=benchmark_counts,
243 )
244 return _summarize_exact(
245 config=config,
246 per_row=per_row,
247 errors=errors,
248 summary=summary,
249 )
250 finally:
251 ensemble_mod._LOW_ESCALATION_THRESHOLD = original_low_threshold
252
253 baseline_config = ExperimentConfig()
254 baseline = run_config(baseline_config)

Callers 1

mainFunction · 0.85

Calls 3

EnsembleClass · 0.90
_config_nameFunction · 0.85
_summarize_exactFunction · 0.85

Tested by

no test coverage detected