Skip to content

Commit

Permalink
Close evaluator after every task
Browse files Browse the repository at this point in the history
  • Loading branch information
tachyonicClock committed Sep 21, 2023
1 parent dbfee07 commit b36dacd
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 5 deletions.
8 changes: 5 additions & 3 deletions moa/src/main/java/moa/tasks/EvaluateConceptDrift.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (immediateResultStream != null) {
immediateResultStream.close();
}
/* if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}*/
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return learningCurve;
}
}
5 changes: 5 additions & 0 deletions moa/src/main/java/moa/tasks/EvaluateModelMultiLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return new LearningEvaluation(evaluator, model);
}
}
5 changes: 5 additions & 0 deletions moa/src/main/java/moa/tasks/EvaluateModelMultiTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return new LearningEvaluation(evaluator, model);
}
}
5 changes: 5 additions & 0 deletions moa/src/main/java/moa/tasks/EvaluateModelRegression.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return new LearningEvaluation(evaluator, model);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return learningCurve;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return learningCurve;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}

try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return learningCurve;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (outputPredictionResultStream != null) {
outputPredictionResultStream.close();
}
try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return learningCurve;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
if (immediateResultStream != null) {
immediateResultStream.close();
}

try {
evaluator.close();
} catch (Exception ex) {
throw new RuntimeException("Exception closing evaluator", ex);
}
return new PreviewCollectionLearningCurveWrapper(learningCurve, this.getClass());
}

Expand Down

0 comments on commit b36dacd

Please sign in to comment.