Documentation of 'jsat.datatransform.featureselection.LRS' Java class
LRS
jsat.datatransform.featureselection

Class LRS

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, DataTransform


    public class LRS
    extends java.lang.Object
    implements DataTransform
    plus-L minus-R Selection (LRS) is a greedy method of selecting a subset of features to use for prediction. Its behavior is dependent upon whether L or R is the larger value. No mater what, L features will be greedily added to the set to decrease the error rate, and R features will be greedily removed while trying to maintain the error rate.
    If L > R, then L-R features will be selected, the L step running first followed by R performing pruning on the found set.
    If L < R, then D-R+L features will be selected, where D is the original number of features. First R features will be removed, and then L of the removed features will be added back to the final set.
    L = R is not allowed.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      LRS(int L, int R, ClassificationDataSet cds, Classifier evaluater, int folds)
      Performs LRS feature selection for a classification problem
      LRS(int L, int R, Classifier evaluater, int folds)
      Creates a LRS feature selection object for a classification problem
      LRS(int L, int R, RegressionDataSet rds, Regressor evaluater, int folds)
      Performs LRS feature selection for a regression problem
      LRS(int L, int R, Regressor evaluater, int folds)
      Creates a LRS feature selection object for a regression problem
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      LRS clone() 
      void fit(DataSet data)
      Fits this transform to the given dataset.
      int getFeaturesToAdd()
      Returns the number of features to add
      int getFeaturesToRemove()
      Returns the number of features to remove
      int getFolds() 
      java.util.Set<java.lang.Integer> getSelectedCategorical()
      Returns a copy of the set of categorical features selected by the search algorithm
      java.util.Set<java.lang.Integer> getSelectedNumerical()
      Returns a copy of the set of numerical features selected by the search algorithm.
      void setFeaturesToAdd(int featuresToAdd)
      Sets the number of features to add (the L parameter).
      void setFeaturesToRemove(int featuresToRemove)
      Sets the number of features to remove (the R parameter).
      void setFolds(int folds)
      Sets the number of folds to use for cross validation when estimating the error rate
      DataPoint transform(DataPoint dp)
      Returns a new data point that is a transformation of the original data point.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LRS

        public LRS(int L,
                   int R,
                   Classifier evaluater,
                   int folds)
        Creates a LRS feature selection object for a classification problem
        Parameters:
        L - the number of features to greedily add
        R - the number of features to greedily remove
        evaluater - the classifier to use in determining accuracy given a feature subset
        folds - the number of cross validation folds to use in selection
      • LRS

        public LRS(int L,
                   int R,
                   ClassificationDataSet cds,
                   Classifier evaluater,
                   int folds)
        Performs LRS feature selection for a classification problem
        Parameters:
        L - the number of features to greedily add
        R - the number of features to greedily remove
        cds - the data set to perform feature selection on
        evaluater - the classifier to use in determining accuracy given a feature subset
        folds - the number of cross validation folds to use in selection
      • LRS

        public LRS(int L,
                   int R,
                   Regressor evaluater,
                   int folds)
        Creates a LRS feature selection object for a regression problem
        Parameters:
        L - the number of features to greedily add
        R - the number of features to greedily remove
        evaluater - the regressor to use in determining accuracy given a feature subset
        folds - the number of cross validation folds to use in selection
      • LRS

        public LRS(int L,
                   int R,
                   RegressionDataSet rds,
                   Regressor evaluater,
                   int folds)
        Performs LRS feature selection for a regression problem
        Parameters:
        L - the number of features to greedily add
        R - the number of features to greedily remove
        rds - the data set to perform feature selection on
        evaluater - the regressor to use in determining accuracy given a feature subset
        folds - the number of cross validation folds to use in selection
    • Method Detail

      • transform

        public DataPoint transform(DataPoint dp)
        Description copied from interface: DataTransform
        Returns 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:
        transform in interface DataTransform
        Parameters:
        dp - the data point to apply a transformation to
        Returns:
        a transformed data point
      • clone

        public LRS clone()
        Specified by:
        clone in interface DataTransform
        Overrides:
        clone in class java.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: DataTransform
        Fits this transform to the given dataset. Some transforms can only be learned from classification or regression datasets. If an incompatible dataset type is given, a FailedToFitException exception may be thrown.
        Specified by:
        fit in interface DataTransform
        Parameters:
        data - the dataset to fir this transform to
      • setFeaturesToAdd

        public void setFeaturesToAdd(int featuresToAdd)
        Sets the number of features to add (the L parameter).
        Parameters:
        featuresToAdd - the number of features to greedily add
      • getFeaturesToAdd

        public int getFeaturesToAdd()
        Returns the number of features to add
        Returns:
        the number of features to add
      • setFeaturesToRemove

        public void setFeaturesToRemove(int featuresToRemove)
        Sets the number of features to remove (the R parameter).
        Parameters:
        featuresToRemove - the number of features to greedily remove
      • getFeaturesToRemove

        public int getFeaturesToRemove()
        Returns the number of features to remove
        Returns:
        the number of features to remove
      • 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

You see the box below because you did not login.