/** * Returns true if any of the base classifiers are able to generate batch predictions * efficiently and all of them implement BatchPredictor. * * @return true if the base classifiers can do batch prediction efficiently */ public boolean baseClassifiersImplementMoreEfficientBatchPrediction() { boolean atLeastOneIsEfficient = false; for (Classifier c : getClassifiers()) { if (!(c instanceof BatchPredictor)) { return super.implementsMoreEfficientBatchPrediction(); } atLeastOneIsEfficient |= ((BatchPredictor) c).implementsMoreEfficientBatchPrediction(); } return atLeastOneIsEfficient; }
/** * Returns true if the meta classifier or any of the base classifiers are able to generate batch predictions * efficiently and all of them implement BatchPredictor. * * @return true if batch prediction can be done efficiently */ public boolean implementsMoreEfficientBatchPrediction() { if (!(getMetaClassifier() instanceof BatchPredictor)) { return super.implementsMoreEfficientBatchPrediction(); } boolean atLeastOneIsEfficient = false; for (Classifier c : getClassifiers()) { if (!(c instanceof BatchPredictor)) { return super.implementsMoreEfficientBatchPrediction(); } atLeastOneIsEfficient |= ((BatchPredictor) c).implementsMoreEfficientBatchPrediction(); } return atLeastOneIsEfficient || ((BatchPredictor) getMetaClassifier()).implementsMoreEfficientBatchPrediction(); }