MCPcopy Create free account
hub / github.com/Sphere-AI-Lab/FormalMATH-Bench / simulate_single

Function simulate_single

evaluate_results.py:12–36  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

10 return any(answer['answer_bool'] for answer in sampled_answers)
11
12def simulate_single(args):
13 data, sample_sizes = args
14 all_theorems = list(data.keys())
15 correct_counts = {size: 0 for size in sample_sizes}
16 applicable_counts = {size: 0 for size in sample_sizes}
17
18 for theorem in all_theorems:
19 answers = data[theorem]
20 num_answers = len(answers)
21
22 for size in sample_sizes:
23 # Skip sample sizes larger than the number of available answers
24 if size > num_answers:
25 continue
26 applicable_counts[size] += 1
27 if check_correct(answers, size):
28 correct_counts[size] += 1
29
30 # Calculate the success rate for each sample size
31 aggregate_rates = {}
32 for size in sample_sizes:
33 rate = correct_counts[size] / applicable_counts[size] if applicable_counts[size] > 0 else 0
34 aggregate_rates[str(size)] = rate
35 print(f"size,{correct_counts[size]}")
36 return aggregate_rates
37
38def monte_carlo_evaluate(
39 input_filepath,

Callers

nothing calls this directly

Calls 1

check_correctFunction · 0.85

Tested by

no test coverage detected