List of usage examples for org.opencv.ml RTrees setTermCriteria
public void setTermCriteria(TermCriteria val)
From source file:qupath.opencv.classify.RTreesClassifier.java
License:Open Source License
@Override protected RTrees createClassifier() { RTrees trees = RTrees.create(); ParameterList params = getParameterList(); if (params != null) { int maxDepth = params.getIntParameterValue("maxDepth"); int minSamples = params.getIntParameterValue("minSamples"); boolean use1SE = params.getBooleanParameterValue("use1SE"); trees.setMaxDepth(maxDepth == 0 ? Integer.MAX_VALUE : maxDepth); trees.setMinSampleCount(minSamples); trees.setUse1SERule(use1SE);/* w ww . j a v a 2s . c o m*/ // setUseSurrogates should help with missing data... but it appears not actually to be implemented // System.out.println("DEFAULT SURROGATES: " + trees.getUseSurrogates()); // trees.setUseSurrogates(true); // Set termination criteria int termCritMaxTrees = params.getIntParameterValue("termCritMaxTrees"); double termCritEPS = params.getDoubleParameterValue("termCritEPS"); termCriteria = createTerminationCriteria(termCritMaxTrees, termCritEPS); if (termCriteria != null) trees.setTermCriteria(termCriteria); else termCriteria = trees.getTermCriteria(); logger.info("RTrees classifier termination criteria: {}", termCriteria); } // lastDescription = getName() + "\n\nMain parameters:\n " + DefaultPluginWorkflowStep.getParameterListJSON(params, "\n ") + "\n\nTermination criteria:\n " + termCriteria.toString(); // // } else // lastDescription = null; // trees.setCVFolds(5); // Seems to cause segfault... // trees.setCalculateVarImportance(true); // Seems to require surrogates, but... // trees.setUseSurrogates(true); // // Seems not yet to be supported... return trees; }