jsat.datatransform.featureselection
Class SBS
- java.lang.Object
-
- jsat.datatransform.RemoveAttributeTransform
-
- jsat.datatransform.featureselection.SBS
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform
public class SBS extends RemoveAttributeTransform
Sequential Backward Selection (SBS) is a greedy method of selecting a subset of features to use for prediction. It starts from the set of all features and attempts to remove the least informative feature from the set at each iteration- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SBS(int minFeatures, int maxFeatures, ClassificationDataSet cds, Classifier evaluater, int folds, double maxDecrease)Performs SBS feature selection for a classification problemSBS(int minFeatures, int maxFeatures, Classifier evaluater, double maxDecrease)Performs SBS feature selection for a classification problemSBS(int minFeatures, int maxFeatures, RegressionDataSet rds, Regressor evaluater, int folds, double maxDecrease)Performs SBS feature selection for a regression problemSBS(int minFeatures, int maxFeatures, Regressor evaluater, double maxDecrease)Performs SBS feature selection for a regression problem
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SBSclone()voidfit(DataSet data)Fits this transform to the given dataset.intgetFolds()doublegetMaxDecrease()Returns the maximum allowable decrease in accuracy from one set of features to the nextintgetMaxFeatures()Returns the maximum number of features to findintgetMinFeatures()Returns the minimum number of features to findjava.util.Set<java.lang.Integer>getSelectedCategorical()Returns a copy of the set of categorical features selected by the search algorithmjava.util.Set<java.lang.Integer>getSelectedNumerical()Returns a copy of the set of numerical features selected by the search algorithm.voidsetFolds(int folds)Sets the number of folds to use for cross validation when estimating the error ratevoidsetMaxDecrease(double maxDecrease)Sets the maximum allowable decrease in accuracy (increase in error) from the previous set of features to the new current set.voidsetMaxFeatures(int maxFeatures)Sets the maximum number of features that must be selectedvoidsetMinFeatures(int minFeatures)Sets the minimum number of features that must be selected-
Methods inherited from class jsat.datatransform.RemoveAttributeTransform
consolidate, getKeptNominal, getKeptNumeric, getReverseNominalMap, getReverseNumericMap, transform
-
-
-
-
Constructor Detail
-
SBS
public SBS(int minFeatures, int maxFeatures, Classifier evaluater, double maxDecrease)Performs SBS feature selection for a classification problem- Parameters:
minFeatures- the minimum number of features to findmaxFeatures- the maximum number of features to findevaluater- the classifier to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selectionmaxDecrease- the maximum tolerable decrease in accuracy in accuracy when a feature is removed
-
SBS
public SBS(int minFeatures, int maxFeatures, ClassificationDataSet cds, Classifier evaluater, int folds, double maxDecrease)Performs SBS feature selection for a classification problem- Parameters:
minFeatures- the minimum number of features to findmaxFeatures- the maximum number of features to findcds- the data set to perform feature selection onevaluater- the classifier to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selectionmaxDecrease- the maximum tolerable decrease in accuracy in accuracy when a feature is removed
-
SBS
public SBS(int minFeatures, int maxFeatures, Regressor evaluater, double maxDecrease)Performs SBS feature selection for a regression problem- Parameters:
minFeatures- the minimum number of features to findmaxFeatures- the maximum number of features to findevaluater- the regressor to use in determining accuracy given a feature subsetmaxDecrease- the maximum tolerable increase in the error rate when a feature is removed
-
SBS
public SBS(int minFeatures, int maxFeatures, RegressionDataSet rds, Regressor evaluater, int folds, double maxDecrease)Performs SBS feature selection for a regression problem- Parameters:
minFeatures- the minimum number of features to findmaxFeatures- the maximum number of features to findrds- the data set to perform feature selection onevaluater- the regressor to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selectionmaxDecrease- the maximum tolerable increase in the error rate when a feature is removed
-
-
Method Detail
-
fit
public void fit(DataSet data)
Description copied from interface:DataTransformFits this transform to the given dataset. Some transforms can only be learned from classification or regression datasets. If an incompatible dataset type is given, aFailedToFitExceptionexception may be thrown.- Specified by:
fitin interfaceDataTransform- Overrides:
fitin classRemoveAttributeTransform- Parameters:
data- the dataset to fir this transform to
-
clone
public SBS clone()
- Specified by:
clonein interfaceDataTransform- Overrides:
clonein classRemoveAttributeTransform
-
getSelectedCategorical
public java.util.Set<java.lang.Integer> getSelectedCategorical()
Returns a copy of the set of categorical features selected by the search algorithm- Returns:
- the set of categorical features to use
-
getSelectedNumerical
public java.util.Set<java.lang.Integer> getSelectedNumerical()
Returns a copy of the set of numerical features selected by the search algorithm.- Returns:
- the set of numeric features to use
-
setMaxDecrease
public void setMaxDecrease(double maxDecrease)
Sets the maximum allowable decrease in accuracy (increase in error) from the previous set of features to the new current set.- Parameters:
maxDecrease- the maximum allowable decrease in the accuracy from removing a feature
-
getMaxDecrease
public double getMaxDecrease()
Returns the maximum allowable decrease in accuracy from one set of features to the next- Returns:
- the maximum allowable decrease in accuracy from one set of features to the next
-
setMinFeatures
public void setMinFeatures(int minFeatures)
Sets the minimum number of features that must be selected- Parameters:
minFeatures- the minimum number of features to learn
-
getMinFeatures
public int getMinFeatures()
Returns the minimum number of features to find- Returns:
- the minimum number of features to find
-
setMaxFeatures
public void setMaxFeatures(int maxFeatures)
Sets the maximum number of features that must be selected- Parameters:
maxFeatures- the maximum number of features to find
-
getMaxFeatures
public int getMaxFeatures()
Returns the maximum number of features to find- Returns:
- the maximum number of features to find
-
setFolds
public void setFolds(int folds)
Sets the number of folds to use for cross validation when estimating the error rate- Parameters:
folds- the number of folds to use for cross validation when estimating the error rate
-
getFolds
public int getFolds()
- Returns:
- the number of folds to use for cross validation when estimating the error rate
-
-
DataMelt 3.0 © DataMelt by jWork.ORG