jsat.datatransform.featureselection
Class BDS
- java.lang.Object
-
- jsat.datatransform.featureselection.BDS
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform
public class BDS extends java.lang.Object implements DataTransform
Bidirectional Search (BDS) is a greedy method of selecting a subset of features to use for prediction. It performs bothSFSandSBSsearch at the same time. At each step, a feature is greedily added to one set, and then a feature greedily removed from another set. Once a feature is added / removed in one set, it is unavailable for selection in the other. This can be used to select up to half of the original features.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BDS(BDS toClone)Copy constructorBDS(int featureCount, ClassificationDataSet dataSet, Classifier evaluator, int folds)Performs BDS feature selection for a classification problemBDS(int featureCount, Classifier evaluator, int folds)Creates a BDS feature selection for a classification problemBDS(int featureCount, RegressionDataSet dataSet, Regressor evaluator, int folds)Performs BDS feature selection for a regression problemBDS(int featureCount, Regressor evaluator, int folds)Creates a BDS feature selection for a regression problem
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description BDSclone()voidfit(DataSet data)Fits this transform to the given dataset.intgetFeatureCount()Returns the number of features to useintgetFolds()java.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.voidsetFeatureCount(int featureCount)Sets the number of features to select for use from the set of all input featuresvoidsetFolds(int folds)Sets the number of folds to use for cross validation when estimating the error rateDataPointtransform(DataPoint dp)Returns a new data point that is a transformation of the original data point.
-
-
-
Constructor Detail
-
BDS
public BDS(BDS toClone)
Copy constructor- Parameters:
toClone-
-
BDS
public BDS(int featureCount, Classifier evaluator, int folds)Creates a BDS feature selection for a classification problem- Parameters:
featureCount- the number of features to selectdataSet- the data set to perform feature selection onevaluator- the classifier to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selection
-
BDS
public BDS(int featureCount, ClassificationDataSet dataSet, Classifier evaluator, int folds)Performs BDS feature selection for a classification problem- Parameters:
featureCount- the number of features to selectdataSet- the data set to perform feature selection onevaluator- the classifier to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selection
-
BDS
public BDS(int featureCount, Regressor evaluator, int folds)Creates a BDS feature selection for a regression problem- Parameters:
featureCount- the number of features to selectevaluator- the regressor to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selection
-
BDS
public BDS(int featureCount, RegressionDataSet dataSet, Regressor evaluator, int folds)Performs BDS feature selection for a regression problem- Parameters:
featureCount- the number of features to selectdataSet- the data set to perform feature selection onevaluator- the regressor to use in determining accuracy given a feature subsetfolds- the number of cross validation folds to use in selection
-
-
Method Detail
-
transform
public DataPoint transform(DataPoint dp)
Description copied from interface:DataTransformReturns a new data point that is a transformation of the original data point. This new data point is a different object, but may contain the same references as the original data point. It is not guaranteed that you can mutate the transformed point without having a side effect on the original point.- Specified by:
transformin interfaceDataTransform- Parameters:
dp- the data point to apply a transformation to- Returns:
- a transformed data point
-
clone
public BDS clone()
- Specified by:
clonein interfaceDataTransform- Overrides:
clonein classjava.lang.Object
-
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
-
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- Parameters:
data- the dataset to fir this transform to
-
setFeatureCount
public void setFeatureCount(int featureCount)
Sets the number of features to select for use from the set of all input features- Parameters:
featureCount- the number of features to use
-
getFeatureCount
public int getFeatureCount()
Returns the number of features to use- Returns:
- the number of features to use
-
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