jsat.datatransform
Class NominalToNumeric
- java.lang.Object
-
- jsat.datatransform.NominalToNumeric
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform
public class NominalToNumeric extends java.lang.Object implements DataTransform
This transform converts nominal feature values to numeric ones be adding a new numeric feature for each possible categorical value for each nominal feature. The numeric features will be all zeros, with only a single numeric feature having a value of "1.0" for each nominal variable.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NominalToNumeric()Creates a new transform to convert categorical to numeric featuresNominalToNumeric(DataSet dataSet)Creates a new transform to convert categorical to numeric features for the given datasetNominalToNumeric(NominalToNumeric toCopy)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description NominalToNumericclone()voidfit(DataSet data)Fits this transform to the given dataset.DataPointtransform(DataPoint dp)Returns a new data point that is a transformation of the original data point.
-
-
-
Constructor Detail
-
NominalToNumeric
public NominalToNumeric()
Creates a new transform to convert categorical to numeric features
-
NominalToNumeric
public NominalToNumeric(DataSet dataSet)
Creates a new transform to convert categorical to numeric features for the given dataset- Parameters:
dataSet- the dataset to fit the transform to
-
NominalToNumeric
public NominalToNumeric(NominalToNumeric toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
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- Parameters:
data- the dataset to fir this transform to
-
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 NominalToNumeric clone()
- Specified by:
clonein interfaceDataTransform- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG