jsat.datatransform
Class RemoveAttributeTransform
- java.lang.Object
-
- jsat.datatransform.RemoveAttributeTransform
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform
- Direct Known Subclasses:
- MutualInfoFS, ReliefF, SBS
public class RemoveAttributeTransform extends java.lang.Object implements DataTransform
This Data Transform allows the complete removal of specific features from the data set.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description RemoveAttributeTransform(DataSet dataSet, java.util.Set<java.lang.Integer> categoricalToRemove, java.util.Set<java.lang.Integer> numericalToRemove)Creates a new transform for removing specified features from a data setRemoveAttributeTransform(java.util.Set<java.lang.Integer> categoricalToRemove, java.util.Set<java.lang.Integer> numericalToRemove)Creates a new transform for removing specified features from a data set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RemoveAttributeTransformclone()voidconsolidate(RemoveAttributeTransform preceding)A serious of Remove Attribute Transforms may be learned and applied sequentially to a single data set.voidfit(DataSet data)Fits this transform to the given dataset.java.util.List<java.lang.Integer>getKeptNominal()Returns an unmodifiable list of the original indices of the nominal attributes that will be kept when this transform is applied.java.util.List<java.lang.Integer>getKeptNumeric()Returns an unmodifiable list of the original indices of the numeric attributes that will be kept when this transform is applied.java.util.Map<java.lang.Integer,java.lang.Integer>getReverseNominalMap()Returns a mapping from the nominal indices in the transformed space back to their original indicesjava.util.Map<java.lang.Integer,java.lang.Integer>getReverseNumericMap()Returns a mapping from the numeric indices in the transformed space back to their original indicesDataPointtransform(DataPoint dp)Returns a new data point that is a transformation of the original data point.
-
-
-
Constructor Detail
-
RemoveAttributeTransform
public RemoveAttributeTransform(java.util.Set<java.lang.Integer> categoricalToRemove, java.util.Set<java.lang.Integer> numericalToRemove)Creates a new transform for removing specified features from a data set. Needs to still callfit(jsat.DataSet)before ready to be used.- Parameters:
categoricalToRemove- the set of categorical attributes to remove, in the rage of [0,DataSet.getNumCategoricalVars()).numericalToRemove- the set of numerical attributes to remove, in the rage of [0,DataSet.getNumNumericalVars()).
-
RemoveAttributeTransform
public RemoveAttributeTransform(DataSet dataSet, java.util.Set<java.lang.Integer> categoricalToRemove, java.util.Set<java.lang.Integer> numericalToRemove)
Creates a new transform for removing specified features from a data set- Parameters:
dataSet- the data set that this transform is meant forcategoricalToRemove- the set of categorical attributes to remove, in the rage of [0,DataSet.getNumCategoricalVars()).numericalToRemove- the set of numerical attributes to remove, in the rage of [0,DataSet.getNumNumericalVars()).
-
-
Method Detail
-
getKeptNumeric
public java.util.List<java.lang.Integer> getKeptNumeric()
Returns an unmodifiable list of the original indices of the numeric attributes that will be kept when this transform is applied.- Returns:
- the numeric indices that are not removed by this transform
-
getReverseNumericMap
public java.util.Map<java.lang.Integer,java.lang.Integer> getReverseNumericMap()
Returns a mapping from the numeric indices in the transformed space back to their original indices- Returns:
- a mapping from the transformed numeric space to the original one
-
getKeptNominal
public java.util.List<java.lang.Integer> getKeptNominal()
Returns an unmodifiable list of the original indices of the nominal attributes that will be kept when this transform is applied.- Returns:
- the nominal indices that are not removed by this transform
-
getReverseNominalMap
public java.util.Map<java.lang.Integer,java.lang.Integer> getReverseNominalMap()
Returns a mapping from the nominal indices in the transformed space back to their original indices- Returns:
- a mapping from the transformed nominal space to the original one
-
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
-
consolidate
public void consolidate(RemoveAttributeTransform preceding)
A serious of Remove Attribute Transforms may be learned and applied sequentially to a single data set. Instead of keeping all the transforms around indefinitely, a sequential series of Remove Attribute Transforms can be consolidated into a single transform object.
This method mutates the this transform by providing it with the transform that would have been applied before this current object. Once complete, this transform can be used two perform both removals in one step.
Example:
An initial set of features A is transformed into A' by transform t1
A' is transformed into A'' by transform t2
Instead, you can invoke t2.consolidate(t1). You can then transform A into A'' by using only transform t2- Parameters:
preceding- the DataTransform that immediately precedes this one in a sequential list of transforms
-
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 RemoveAttributeTransform clone()
- Specified by:
clonein interfaceDataTransform- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG