-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevolutionary_evaluator.py
More file actions
36 lines (26 loc) · 922 Bytes
/
evolutionary_evaluator.py
File metadata and controls
36 lines (26 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class EvolutionaryEvaluator:
"""
Evaluates system using both static + generated tests.
"""
def __init__(self, static_tests, adaptive_generator):
self.static_tests = static_tests
self.adaptive_generator = adaptive_generator
# =====================================================
# RUN ALL TESTS
# =====================================================
def evaluate(self, system):
results = []
all_tests = (
self.static_tests +
self.adaptive_generator.get_tests()
)
for test in all_tests:
try:
system.run_cycle_live(
goal="test",
input_text=test.get("input_state", {})
)
results.append(True)
except Exception:
results.append(False)
return sum(results) / max(1, len(results))