Codota Logo
RandomForest
Code IndexAdd Codota to your IDE (free)

How to use
RandomForest
in
weka.classifiers.trees

Best Java code snippets using weka.classifiers.trees.RandomForest (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: nz.ac.waikato.cms.weka/weka-stable

/** Creates a default RandomForest */
public Classifier getClassifier() {
 return new RandomForest();
}
origin: nz.ac.waikato.cms.weka/weka-stable

result.add("" + getBagSizePercent());
if (getCalcOutOfBag()) {
 result.add("-O");
if (getStoreOutOfBagPredictions()) {
 result.add("-store-out-of-bag-predictions");
if (getOutputOutOfBagComplexityStatistics()) {
 result.add("-output-out-of-bag-complexity-statistics");
if (getPrintClassifiers()) {
 result.add("-print");
if (getComputeAttributeImportance()) {
 result.add("-attribute-importance");
result.add("" + getNumIterations());
result.add("" + getNumExecutionSlots());
if (getDoNotCheckCapabilities()) {
 result.add("-do-not-check-capabilities");
 ((OptionHandler) getClassifier()).getOptions());
Option.deleteFlagString(classifierOptions, "-do-not-check-capabilities");
result.addAll(classifierOptions);
origin: nz.ac.waikato.cms.weka/weka-stable

 /**
  * Main method for this class.
  * 
  * @param argv the options
  */
 public static void main(String[] argv) {
  runClassifier(new RandomForest(), argv);
 }
}
origin: Waikato/weka-trunk

 setBagSizePercent(Integer.parseInt(bagSize));
} else {
 setBagSizePercent(100);
setCalcOutOfBag(Utils.getFlag('O', options));
setStoreOutOfBagPredictions(Utils.getFlag("store-out-of-bag-predictions",
 options));
setOutputOutOfBagComplexityStatistics(Utils.getFlag(
 "output-out-of-bag-complexity-statistics", options));
setPrintClassifiers(Utils.getFlag("print", options));
setComputeAttributeImportance(Utils
 .getFlag("attribute-importance", options));
 setNumIterations(Integer.parseInt(iterations));
} else {
 setNumIterations(defaultNumberOfIterations());
 setNumExecutionSlots(Integer.parseInt(numSlots));
} else {
 setNumExecutionSlots(1);
 ((RandomTree) AbstractClassifier.forName(defaultClassifierString(),
  options));
classifier.setComputeImpurityDecreases(m_computeAttributeImportance);
setDoNotCheckCapabilities(classifier.getDoNotCheckCapabilities());
origin: stackoverflow.com

trainData.setClassIndex(trainData.numAttributes() - 1);
RandomForest rf = new RandomForest();
rf.setNumTrees(50);
rf.setOptions(options);
rf.buildClassifier(trainData);
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Returns the tip text for this property
 *
 * @return tip text for this property suitable for displaying in the
 *         explorer/experimenter gui
 */
public String breakTiesRandomlyTipText() {
 return ((RandomTree) getClassifier()).breakTiesRandomlyTipText();
}
origin: Waikato/weka-trunk

buffer.append(super.toString());
if (getComputeAttributeImportance()) {
 try {
  double[] nodeCounts = new double[m_data.numAttributes()];
  double[] impurityScores =
   computeAverageImpurityDecreasePerAttribute(nodeCounts);
  int[] sortedIndices = Utils.sort(impurityScores);
  buffer
     .append(
      Utils.doubleToString(impurityScores[index], 10,
       getNumDecimalPlaces())).append(" (")
     .append(Utils.doubleToString(nodeCounts[index], 6, 0))
     .append(")  ").append(m_data.attribute(index).name())
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Constructor that sets base classifier for bagging to RandomTre and default
 * number of iterations to 100.
 */
public RandomForest() {
 RandomTree rTree = new RandomTree();
 rTree.setDoNotCheckCapabilities(true);
 super.setClassifier(rTree);
 super.setRepresentCopiesUsingWeights(true);
 setNumIterations(defaultNumberOfIterations());
}
origin: nz.ac.waikato.cms.weka/weka-stable

 + "\t(current value " + getNumIterations() + ")", "I", 1, "-I <num>"));
 Collections.list(((OptionHandler) getClassifier()).listOptions());
newVector.addAll(list);
origin: nz.ac.waikato.cms.weka/weka-stable

if (!getComputeAttributeImportance()) {
 throw new WekaException("Stats for attribute importance have not "
  + "been collected!");
origin: nz.ac.waikato.cms.weka/weka-stable

 setBagSizePercent(Integer.parseInt(bagSize));
} else {
 setBagSizePercent(100);
setCalcOutOfBag(Utils.getFlag('O', options));
setStoreOutOfBagPredictions(Utils.getFlag("store-out-of-bag-predictions",
 options));
setOutputOutOfBagComplexityStatistics(Utils.getFlag(
 "output-out-of-bag-complexity-statistics", options));
setPrintClassifiers(Utils.getFlag("print", options));
setComputeAttributeImportance(Utils
 .getFlag("attribute-importance", options));
 setNumIterations(Integer.parseInt(iterations));
} else {
 setNumIterations(defaultNumberOfIterations());
 setNumExecutionSlots(Integer.parseInt(numSlots));
} else {
 setNumExecutionSlots(1);
 ((RandomTree) AbstractClassifier.forName(defaultClassifierString(),
  options));
classifier.setComputeImpurityDecreases(m_computeAttributeImportance);
setDoNotCheckCapabilities(classifier.getDoNotCheckCapabilities());
origin: Waikato/weka-trunk

 /**
  * Main method for this class.
  * 
  * @param argv the options
  */
 public static void main(String[] argv) {
  runClassifier(new RandomForest(), argv);
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Set the maximum depth of the tree, 0 for unlimited.
 *
 * @param value the maximum depth.
 */
public void setMaxDepth(int value) {
 ((RandomTree) getClassifier()).setMaxDepth(value);
}
origin: nz.ac.waikato.cms.weka/weka-stable

buffer.append(super.toString());
if (getComputeAttributeImportance()) {
 try {
  double[] nodeCounts = new double[m_data.numAttributes()];
  double[] impurityScores =
   computeAverageImpurityDecreasePerAttribute(nodeCounts);
  int[] sortedIndices = Utils.sort(impurityScores);
  buffer
     .append(
      Utils.doubleToString(impurityScores[index], 10,
       getNumDecimalPlaces())).append(" (")
     .append(Utils.doubleToString(nodeCounts[index], 6, 0))
     .append(")  ").append(m_data.attribute(index).name())
origin: Waikato/weka-trunk

/**
 * Constructor that sets base classifier for bagging to RandomTre and default
 * number of iterations to 100.
 */
public RandomForest() {
 RandomTree rTree = new RandomTree();
 rTree.setDoNotCheckCapabilities(true);
 super.setClassifier(rTree);
 super.setRepresentCopiesUsingWeights(true);
 setNumIterations(defaultNumberOfIterations());
}
origin: Waikato/weka-trunk

 + "\t(current value " + getNumIterations() + ")", "I", 1, "-I <num>"));
 Collections.list(((OptionHandler) getClassifier()).listOptions());
newVector.addAll(list);
origin: Waikato/weka-trunk

if (!getComputeAttributeImportance()) {
 throw new WekaException("Stats for attribute importance have not "
  + "been collected!");
origin: Waikato/weka-trunk

result.add("" + getBagSizePercent());
if (getCalcOutOfBag()) {
 result.add("-O");
if (getStoreOutOfBagPredictions()) {
 result.add("-store-out-of-bag-predictions");
if (getOutputOutOfBagComplexityStatistics()) {
 result.add("-output-out-of-bag-complexity-statistics");
if (getPrintClassifiers()) {
 result.add("-print");
if (getComputeAttributeImportance()) {
 result.add("-attribute-importance");
result.add("" + getNumIterations());
result.add("" + getNumExecutionSlots());
if (getDoNotCheckCapabilities()) {
 result.add("-do-not-check-capabilities");
 ((OptionHandler) getClassifier()).getOptions());
Option.deleteFlagString(classifierOptions, "-do-not-check-capabilities");
result.addAll(classifierOptions);
origin: Waikato/weka-trunk

/** Creates a default RandomForest */
public Classifier getClassifier() {
 return new RandomForest();
}
origin: Waikato/weka-trunk

/**
 * Returns the tip text for this property
 *
 * @return tip text for this property suitable for displaying in the
 *         explorer/experimenter gui
 */
public String breakTiesRandomlyTipText() {
 return ((RandomTree) getClassifier()).breakTiesRandomlyTipText();
}
weka.classifiers.treesRandomForest

Javadoc

Class for constructing a forest of random trees.

For more information see:

Leo Breiman (2001). Random Forests. Machine Learning. 45(1):5-32.

BibTeX:
 
@article{Breiman2001, 
author = {Leo Breiman}, 
journal = {Machine Learning}, 
number = {1}, 
pages = {5-32}, 
title = {Random Forests}, 
volume = {45}, 
year = {2001} 
} 


Valid options are:

 
-P 
Size of each bag, as a percentage of the 
training set size. (default 100) 
 
-O 
Calculate the out of bag error. 
 
-store-out-of-bag-predictions 
Whether to store out of bag predictions in internal evaluation object. 
 
-output-out-of-bag-complexity-statistics 
Whether to output complexity-based statistics when out-of-bag evaluation is performed. 
 
-print 
Print the individual classifiers in the output 
 
-attribute-importance 
Compute and output attribute importance (mean impurity decrease method) 
 
-I <num> 
Number of iterations. 
(current value 100) 
 
-num-slots <num> 
Number of execution slots. 
(default 1 - i.e. no parallelism) 
(use 0 to auto-detect number of cores) 
 
-K <number of attributes> 
Number of attributes to randomly investigate. (default 0) 
(<1 = int(log_2(#predictors)+1)). 
 
-M <minimum number of instances> 
Set minimum number of instances per leaf. 
(default 1) 
 
-V <minimum variance for split> 
Set minimum numeric class variance proportion 
of train variance for split (default 1e-3). 
 
-S <num> 
Seed for random number generator. 
(default 1) 
 
-depth <num> 
The maximum depth of the tree, 0 for unlimited. 
(default 0) 
 
-N <num> 
Number of folds for backfitting (default 0, no backfitting). 
 
-U 
Allow unclassified instances. 
 
-B 
Break ties randomly when several attributes look equally good. 
 
-output-debug-info 
If set, classifier is run in debug mode and 
may output additional info to the console 
 
-do-not-check-capabilities 
If set, classifier capabilities are not checked before classifier is built 
(use with caution). 
 
-num-decimal-places 
The number of decimal places for the output of numbers in the model (default 2). 
 
-batch-size 
The desired batch size for batch prediction  (default 100). 

Most used methods

  • <init>
    Constructor that sets base classifier for bagging to RandomTre and default number of iterations to 1
  • computeAverageImpurityDecreasePerAttribute
    Computes the average impurity decrease per attribute over the trees
  • defaultClassifierString
    String describing default classifier.
  • defaultNumberOfIterations
    The default number of iterations to perform.
  • getBagSizePercent
  • getCalcOutOfBag
  • getClassifier
  • getComputeAttributeImportance
    Get whether to compute and output attribute importance scores
  • getDoNotCheckCapabilities
  • getNumDecimalPlaces
  • getNumExecutionSlots
  • getNumIterations
  • getNumExecutionSlots,
  • getNumIterations,
  • getOutputOutOfBagComplexityStatistics,
  • getPrintClassifiers,
  • getStoreOutOfBagPredictions,
  • getTechnicalInformation,
  • runClassifier,
  • setBagSizePercent,
  • setBatchSize,
  • setCalcOutOfBag

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ImageIO (javax.imageio)
  • BoxLayout (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now