Class RandomForestMethod
java.lang.Object
unifeat.featureSelection.FeatureSelection
unifeat.featureSelection.embedded.EmbeddedApproach
unifeat.featureSelection.embedded.TreeBasedMethods.TreeBasedMethods
unifeat.featureSelection.embedded.TreeBasedMethods.RandomForestMethod
This java class is used to implement the random forest based method for
feature selection.
- Author:
- Sina Tabakhi
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate intFields inherited from class unifeat.featureSelection.embedded.TreeBasedMethods.TreeBasedMethods
TEMP_PATH, TREE_TYPEFields inherited from class unifeat.featureSelection.embedded.EmbeddedApproach
classLabel, nameFeatures, PROJECT_PATHFields inherited from class unifeat.featureSelection.FeatureSelection
numClass, numFeatures, numSelectedFeature, selectedFeatureSubset, trainSet -
Constructor Summary
ConstructorsConstructorDescriptionRandomForestMethod(Object... arguments) Initializes the parametersRandomForestMethod(String path, int randomForestNumFeatures, int randomForestMaxDepth, int randomForestNumIterations) Initializes the parameters -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildClassifier(weka.core.Instances dataTrain) Generates a classifier using input datavoidStarts the feature selection process by Random Forest based methodprotected voidselectedFeatureSubset(String tree) Finds the feature subset from the nodes of the created tree (Used for Random Forest)Methods inherited from class unifeat.featureSelection.embedded.EmbeddedApproach
loadDataSet, loadDataSet, newMethod, originalFeatureSetMethods inherited from class unifeat.featureSelection.FeatureSelection
getSelectedFeatureSubset, setNumSelectedFeature, validate
-
Field Details
-
randomForestNumFeatures
private int randomForestNumFeatures -
randomForestMaxDepth
private int randomForestMaxDepth -
randomForestNumIterations
private int randomForestNumIterations
-
-
Constructor Details
-
RandomForestMethod
Initializes the parameters- Parameters:
arguments- array of parameter contains (path,tree type,NumFeatures,MaxDepth,NumIterations) in whichpathis the path of the project,tree typeis the type of tree,NumFeaturesis the number of randomly selected features,MaxDepthis the maximum depth of the tree,NumIterationsis 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 projectrandomForestNumFeatures- the number of randomly selected featuresrandomForestMaxDepth- the maximum depth of the treerandomForestNumIterations- the number of iterations to be performed
-
-
Method Details
-
selectedFeatureSubset
Finds the feature subset from the nodes of the created tree (Used for Random Forest)- Specified by:
selectedFeatureSubsetin classTreeBasedMethods- Parameters:
tree- the generated tree based on the train set
-
buildClassifier
Generates a classifier using input data- Specified by:
buildClassifierin classTreeBasedMethods- 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:
evaluateFeaturesin classFeatureSelection
-