Skip to content

Commit b36dacd

Browse files
Close evaluator after every task
1 parent dbfee07 commit b36dacd

9 files changed

+45
-5
lines changed

moa/src/main/java/moa/tasks/EvaluateConceptDrift.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
231231
if (immediateResultStream != null) {
232232
immediateResultStream.close();
233233
}
234-
/* if (outputPredictionResultStream != null) {
235-
outputPredictionResultStream.close();
236-
}*/
234+
try {
235+
evaluator.close();
236+
} catch (Exception ex) {
237+
throw new RuntimeException("Exception closing evaluator", ex);
238+
}
237239
return learningCurve;
238240
}
239241
}

moa/src/main/java/moa/tasks/EvaluateModelMultiLabel.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ public Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
156156
if (outputPredictionResultStream != null) {
157157
outputPredictionResultStream.close();
158158
}
159+
try {
160+
evaluator.close();
161+
} catch (Exception ex) {
162+
throw new RuntimeException("Exception closing evaluator", ex);
163+
}
159164
return new LearningEvaluation(evaluator, model);
160165
}
161166
}

moa/src/main/java/moa/tasks/EvaluateModelMultiTarget.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ public Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
152152
if (outputPredictionResultStream != null) {
153153
outputPredictionResultStream.close();
154154
}
155+
try {
156+
evaluator.close();
157+
} catch (Exception ex) {
158+
throw new RuntimeException("Exception closing evaluator", ex);
159+
}
155160
return new LearningEvaluation(evaluator, model);
156161
}
157162
}

moa/src/main/java/moa/tasks/EvaluateModelRegression.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ public Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
152152
if (outputPredictionResultStream != null) {
153153
outputPredictionResultStream.close();
154154
}
155+
try {
156+
evaluator.close();
157+
} catch (Exception ex) {
158+
throw new RuntimeException("Exception closing evaluator", ex);
159+
}
155160
return new LearningEvaluation(evaluator, model);
156161
}
157162
}

moa/src/main/java/moa/tasks/EvaluatePrequentialMultiLabel.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
289289
if (outputPredictionResultStream != null) {
290290
outputPredictionResultStream.close();
291291
}
292+
try {
293+
evaluator.close();
294+
} catch (Exception ex) {
295+
throw new RuntimeException("Exception closing evaluator", ex);
296+
}
292297
return learningCurve;
293298
}
294299
}

moa/src/main/java/moa/tasks/EvaluatePrequentialMultiTarget.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
277277
if (outputPredictionResultStream != null) {
278278
outputPredictionResultStream.close();
279279
}
280+
try {
281+
evaluator.close();
282+
} catch (Exception ex) {
283+
throw new RuntimeException("Exception closing evaluator", ex);
284+
}
280285
return learningCurve;
281286
}
282287
}

moa/src/main/java/moa/tasks/EvaluatePrequentialMultiTargetSemiSuper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
405405
if (outputPredictionResultStream != null) {
406406
outputPredictionResultStream.close();
407407
}
408-
408+
try {
409+
evaluator.close();
410+
} catch (Exception ex) {
411+
throw new RuntimeException("Exception closing evaluator", ex);
412+
}
409413
return learningCurve;
410414
}
411415
}

moa/src/main/java/moa/tasks/EvaluatePrequentialRegression.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
272272
if (outputPredictionResultStream != null) {
273273
outputPredictionResultStream.close();
274274
}
275+
try {
276+
evaluator.close();
277+
} catch (Exception ex) {
278+
throw new RuntimeException("Exception closing evaluator", ex);
279+
}
275280
return learningCurve;
276281
}
277282
}

moa/src/main/java/moa/tasks/meta/ALPrequentialEvaluationTask.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
270270
if (immediateResultStream != null) {
271271
immediateResultStream.close();
272272
}
273-
273+
try {
274+
evaluator.close();
275+
} catch (Exception ex) {
276+
throw new RuntimeException("Exception closing evaluator", ex);
277+
}
274278
return new PreviewCollectionLearningCurveWrapper(learningCurve, this.getClass());
275279
}
276280

0 commit comments

Comments
 (0)