An an evaluateSerial function to Forest

parallelStream doesn't seem to work very well on the ComputeCanada.ca cluster
This commit is contained in:
Joel Therrien 2019-04-05 11:13:23 -07:00
parent bf168bc2a5
commit ea176cff9a

View file

@ -55,6 +55,19 @@ public class Forest<O, FO> { // O = output of trees, FO = forest output. In prac
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* Used primarily in the R package interface to avoid R loops without parallelization.
* I suspect that on some cluster systems using a parallelStream can cause serious crashes.
*
* @param rowList List of CovariateRows to evaluate
* @return A List of predictions.
*/
public List<FO> evaluateSerial(List<? extends CovariateRow> rowList){
return rowList.stream()
.map(this::evaluate)
.collect(Collectors.toList());
}
public FO evaluateOOB(CovariateRow row){ public FO evaluateOOB(CovariateRow row){
return treeResponseCombiner.combine( return treeResponseCombiner.combine(