Improve progress tracking to terminate when all trees are trained
Instead of only checking every second
This commit is contained in:
parent
1e40b7ff9b
commit
4aac73b868
1 changed files with 12 additions and 20 deletions
|
@ -153,15 +153,15 @@ public class ForestTrainer<Y, TO, FO> {
|
|||
executorService.execute(worker);
|
||||
}
|
||||
|
||||
executorService.shutdown();
|
||||
|
||||
int prevNumberTreesSet = -1;
|
||||
while(true){
|
||||
boolean running = true;
|
||||
while(running){
|
||||
try {
|
||||
if (executorService.awaitTermination(1, TimeUnit.SECONDS)) break;
|
||||
if (executorService.awaitTermination(1, TimeUnit.SECONDS)) running = false;
|
||||
} catch (InterruptedException e) {
|
||||
System.err.println("There was an InterruptedException while waiting for the forest to finish training; this is unusual but on its own shouldn't be a problem.");
|
||||
System.err.println("Please send a bug report about it to joelt@sfu.ca");
|
||||
e.printStackTrace();
|
||||
// do nothing; this shouldn't be an issue
|
||||
// do nothing and just continue; this won't happen and if it did we'd just update the counter quicker
|
||||
}
|
||||
|
||||
int numberTreesSet = 0;
|
||||
|
@ -178,10 +178,6 @@ public class ForestTrainer<Y, TO, FO> {
|
|||
prevNumberTreesSet = numberTreesSet;
|
||||
}
|
||||
|
||||
if(numberTreesSet == ntree){
|
||||
executorService.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(displayProgress){
|
||||
|
@ -224,15 +220,15 @@ public class ForestTrainer<Y, TO, FO> {
|
|||
executorService.execute(worker);
|
||||
}
|
||||
|
||||
executorService.shutdown();
|
||||
|
||||
int prevNumberTreesSet = -1;
|
||||
while(true){
|
||||
boolean running = true;
|
||||
while(running){
|
||||
try {
|
||||
if (executorService.awaitTermination(1, TimeUnit.SECONDS)) break;
|
||||
if (executorService.awaitTermination(1, TimeUnit.SECONDS)) running = false;
|
||||
} catch (InterruptedException e) {
|
||||
System.err.println("There was an InterruptedException while waiting for the forest to finish training; this is unusual but on its own shouldn't be a problem.");
|
||||
System.err.println("Please send a bug report about it to joelt@sfu.ca");
|
||||
e.printStackTrace();
|
||||
// do nothing; this shouldn't be an issue
|
||||
// do nothing and just continue; this won't happen and if it did we'd just update the counter quicker
|
||||
}
|
||||
int numberTreesSet = treeCount.get();
|
||||
|
||||
|
@ -244,10 +240,6 @@ public class ForestTrainer<Y, TO, FO> {
|
|||
|
||||
}
|
||||
|
||||
if(numberTreesSet == ntree){
|
||||
executorService.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(displayProgress){
|
||||
|
|
Loading…
Reference in a new issue