jsat.datatransform.featureselection
Class ReliefF
- java.lang.Object
-
- jsat.datatransform.RemoveAttributeTransform
-
- jsat.datatransform.featureselection.ReliefF
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform
public class ReliefF extends RemoveAttributeTransform
Provides an implementation of the ReliefF algorithm for feature importance computing. Because JSAT does not support neighbor searching for categorical values, it does not provides weights for categorical variables.
Weight values are in the range [-1, 1]. The value is a measure of corelation, so the absolute value of the individual weights would form its relative importance to the others.
The ReliefF algorithm is meant for classification problems, and is computed in a nearest neighbor fashion.
See:
Kononenko, I., Simec, E.,&Robnik-Sikonja, M. (1997). Overcoming the myopia of inductive learning algorithms with RELIEFF. Applied Intelligence, 7, 39–55.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm, java.util.concurrent.ExecutorService threadPool)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm, VectorCollection<Vec> vc)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm, VectorCollection<Vec> vcf, java.util.concurrent.ExecutorService threadPool)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.ReliefF(int featureCount)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.ReliefF(int featureCount, int m, int n, DistanceMetric dm)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.ReliefF(int featureCount, int m, int n, DistanceMetric dm, VectorCollection<Vec> vc)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ReliefFclone()voidfit(DataSet data)Fits this transform to the given dataset.voidfit(DataSet data, java.util.concurrent.ExecutorService threadPool)DistanceMetricgetDistanceMetric()Returns the distance metric to useintgetFeatureCount()Returns the number of features to sueintgetIterations()Returns the number of iterations to useintgetNeighbors()Returns the number of neighbors that will be used at each step of the algorithm.VecgetWeights()Returns accesses to the learned weight data.voidsetDistanceMetric(DistanceMetric dm)Sets the distance metric to infer the feature importance withvoidsetFeatureCount(int featureCount)Sets the number of features to select for use from the set of all input featuresvoidsetIterations(int iterations)Sets the number of iterations of the ReliefF algorithm that will be runvoidsetNeighbors(int neighbors)Sets the number of neighbors to use to infer feature importance from-
Methods inherited from class jsat.datatransform.RemoveAttributeTransform
consolidate, getKeptNominal, getKeptNumeric, getReverseNominalMap, getReverseNumericMap, transform
-
-
-
-
Constructor Detail
-
ReliefF
public ReliefF(int featureCount)
Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
featureCount- the number of features to keep
-
ReliefF
public ReliefF(int featureCount, int m, int n, DistanceMetric dm)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
featureCount- the number of features to keepm- the number of learning iterations to performn- the number of neighbors to measure importance fromdm- the distance metric to use
-
ReliefF
public ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm)
Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
cds- the data set to measure numeric variable importance fromfeatureCount- the number of features to keepm- the number of learning iterations to performn- the number of neighbors to measure importance fromdm- the distance metric to use
-
ReliefF
public ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm, java.util.concurrent.ExecutorService threadPool)
Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
cds- the data set to measure numeric variable importance fromfeatureCount- the number of features to keepm- the number of learning iterations to performn- the number of neighbors to measure importance fromdm- the distance metric to usethreadPool- the source of threads to use for the computation
-
ReliefF
public ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm, VectorCollection<Vec> vc)
Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
cds- the data set to measure numeric variable importance fromfeatureCount- the number of features to keepm- the number of learning iterations to performn- the number of neighbors to measure importance fromdm- the distance metric to usevc- the vector collection to create accelerating structures for nearest neighbor
-
ReliefF
public ReliefF(int featureCount, int m, int n, DistanceMetric dm, VectorCollection<Vec> vc)Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
featureCount- the number of features to keepm- the number of learning iterations to performn- the number of neighbors to measure importance fromdm- the distance metric to usevc- the factor to create accelerating structures for nearest neighbor
-
ReliefF
public ReliefF(ClassificationDataSet cds, int featureCount, int m, int n, DistanceMetric dm, VectorCollection<Vec> vcf, java.util.concurrent.ExecutorService threadPool)
Creates a new ReliefF object to measure the importance of the variables with respect to a classification task. Only numeric features will be removed. Categorical features will be ignored and left in tact by the transformation- Parameters:
cds- the data set to measure numeric variable importance fromfeatureCount- the number of features to keepm- the number of learning iterations to performn- the number of neighbors to measure importance fromdm- the distance metric to usevcf- the factor to create accelerating structures for nearest neighborthreadPool- the source of threads to use for the computation
-
-
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
-
fit
public void fit(DataSet data, java.util.concurrent.ExecutorService threadPool)
-
getWeights
public Vec getWeights()
Returns accesses to the learned weight data. Altering the values will be reflected in this original ReliefF object.- Returns:
- access to the raw weight values
-
clone
public ReliefF clone()
- Specified by:
clonein interfaceDataTransform- Overrides:
clonein classRemoveAttributeTransform
-
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 sue- Returns:
- the number of features to sue
-
setIterations
public void setIterations(int iterations)
Sets the number of iterations of the ReliefF algorithm that will be run- Parameters:
iterations- the number of iterations to run
-
getIterations
public int getIterations()
Returns the number of iterations to use- Returns:
- the number of iterations to use
-
setNeighbors
public void setNeighbors(int neighbors)
Sets the number of neighbors to use to infer feature importance from- Parameters:
neighbors- the number of neighbors to use
-
getNeighbors
public int getNeighbors()
Returns the number of neighbors that will be used at each step of the algorithm.- Returns:
- the number of neighbors that will be used
-
setDistanceMetric
public void setDistanceMetric(DistanceMetric dm)
Sets the distance metric to infer the feature importance with- Parameters:
dm- the distance metric to use
-
getDistanceMetric
public DistanceMetric getDistanceMetric()
Returns the distance metric to use- Returns:
- the distance metric to use
-
-
DataMelt 3.0 © DataMelt by jWork.ORG