File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 8282logger .info ('init gp_learner' )
8383
8484
85+ class GPLearnerException (Exception ):
86+ pass
87+
88+
89+ class GPLearnerAbortException (GPLearnerException ):
90+ """Exception base class to be raised to abort whole GP Learner."""
91+ pass
92+
93+
94+ class GPLearnerTestPatternFoundException (GPLearnerAbortException ):
95+ """Exception to be thrown when a test pattern is found.
96+
97+ This exception is used in eval mode to enable early termination as soon as
98+ a test pattern (to be searched) ends up in the results of one generation.
99+ Early termination here allows not wasting additional time for the full
100+ run to complete. It skips out of the code immediately, re-raising the
101+ exception for external (eval) handling.
102+ """
103+ pass
104+
105+
85106def f_measure (precision , recall , beta = config .F_MEASURE_BETA ):
86107 """Calculates the f1-measure from precision and recall."""
87108 if precision + recall <= 0 :
@@ -1178,6 +1199,11 @@ def find_graph_pattern_coverage(
11781199 )
11791200 break
11801201 run += 1
1202+ except GPLearnerAbortException as e :
1203+ # this exception is only raised to intentionally abort the whole
1204+ # learning process. Don't run auto-retry.
1205+ logger .info ('gp learner was aborted intentionally: %r' , e )
1206+ raise
11811207 except Exception as e :
11821208 error_count += 1
11831209 logger .error ('uncaught exception in run %d' % run )
You can’t perform that action at this time.
0 commit comments