Class RandomForestMethod


public class RandomForestMethod extends TreeBasedMethods
This java class is used to implement the random forest based method for feature selection.
Author:
Sina Tabakhi
See Also:
  • Field Details

    • randomForestNumFeatures

      private int randomForestNumFeatures
    • randomForestMaxDepth

      private int randomForestMaxDepth
    • randomForestNumIterations

      private int randomForestNumIterations
  • Constructor Details

    • RandomForestMethod

      public RandomForestMethod(Object... arguments)
      Initializes the parameters
      Parameters:
      arguments - array of parameter contains (path, tree type, NumFeatures, MaxDepth, NumIterations) in which path is the path of the project, tree type is the type of tree, NumFeatures is the number of randomly selected features, MaxDepth is the maximum depth of the tree, NumIterations is the number of iterations to be performed
    • RandomForestMethod

      public RandomForestMethod(String path, int randomForestNumFeatures, int randomForestMaxDepth, int randomForestNumIterations)
      Initializes the parameters
      Parameters:
      path - the path of the project
      randomForestNumFeatures - the number of randomly selected features
      randomForestMaxDepth - the maximum depth of the tree
      randomForestNumIterations - the number of iterations to be performed
  • Method Details

    • selectedFeatureSubset

      protected void selectedFeatureSubset(String tree)
      Finds the feature subset from the nodes of the created tree (Used for Random Forest)
      Specified by:
      selectedFeatureSubset in class TreeBasedMethods
      Parameters:
      tree - the generated tree based on the train set
    • buildClassifier

      protected String buildClassifier(weka.core.Instances dataTrain)
      Generates a classifier using input data
      Specified by:
      buildClassifier in class TreeBasedMethods
      Parameters:
      dataTrain - the data to train the classifier
      Returns:
      the output of the generated classifier
    • evaluateFeatures

      public void evaluateFeatures()
      Starts the feature selection process by Random Forest based method
      Specified by:
      evaluateFeatures in class FeatureSelection