List of usage examples for weka.classifiers.trees RandomForest setSeed
public void setSeed(int s)
From source file:predictors.HelixIndexer.java
License:Open Source License
/** * Trains the Weka Classifer.//from w w w.java2 s.c o m */ public void trainClassifier() { try { RandomForest classifier = new weka.classifiers.trees.RandomForest(); Instances data = this.dataset; if (data.classIndex() == -1) { data.setClassIndex(data.numAttributes() - 1); } data.randomize(new Random(data.size())); String[] optClassifier = weka.core.Utils.splitOptions("-I 100 -K 9 -S 1 -num-slots 3"); classifier.setOptions(optClassifier); classifier.setSeed(data.size()); classifier.buildClassifier(data); this.classifier = classifier; this.isTrained = true; } catch (Exception e) { ErrorUtils.printError(HelixIndexer.class, "Training failed", e); } }
From source file:predictors.TopologyPredictor.java
License:Open Source License
/** * Trains the Weka Classifer./*w ww . java 2 s. c om*/ */ public void trainClassifier() { try { RandomForest classifier = new weka.classifiers.trees.RandomForest(); Instances data = this.dataset; if (data.classIndex() == -1) { data.setClassIndex(data.numAttributes() - 1); } data.randomize(new Random(data.size())); String[] optClassifier = weka.core.Utils.splitOptions("-I 100 -K 7 -S 1 -num-slots 1"); classifier.setOptions(optClassifier); classifier.setSeed(data.size()); classifier.buildClassifier(data); this.classifier = classifier; this.isTrained = true; } catch (Exception e) { ErrorUtils.printError(TopologyPredictor.class, "Training failed", e); } }