jsat.datatransform
Class DataTransformProcess
- java.lang.Object
-
- jsat.datatransform.DataTransformProcess
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform, Parameterized
public class DataTransformProcess extends java.lang.Object implements DataTransform, Parameterized
Performing a transform on the whole data set before training a classifier can add bias to the results. For proper evaluation, the transforms must be learned from the training set and not contain any knowledge from the testing set. A DataTransformProcess aids in this by providing a mechanism to contain several different transforms to learn and then apply.
The Parameters of the Data Transform Process are the parameters from the individual transform factories that make up the whole process. The name "DataTransformProcess" will not be prefixed to the parameter names.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DataTransformProcess()Creates a new transform process that is empty.DataTransformProcess(DataTransform... transforms)Creates a new transform process from the listed factories, which will be applied in order by index.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddTransform(DataTransform transform)Adds a transform to the list of transforms.DataTransformProcessclone()voidfit(DataSet data)Fits this transform to the given dataset.intgetNumberOfTransforms()voidleanTransforms(DataSet dataSet)Learns the transforms for the given data set.voidlearnApplyTransforms(DataSet dataSet)Learns the transforms for the given data set.DataPointtransform(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
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
DataTransformProcess
public DataTransformProcess()
Creates a new transform process that is empty. Transform factories must be added using#addTransform(jsat.datatransform.DataTransformFactory).
-
DataTransformProcess
public DataTransformProcess(DataTransform... transforms)
Creates a new transform process from the listed factories, which will be applied in order by index.- Parameters:
transforms- the array of factories to apply as the data transform process
-
-
Method Detail
-
addTransform
public void addTransform(DataTransform transform)
Adds a transform to the list of transforms. Transforms are learned and applied in the order in which they are added.- Parameters:
transform- the factory for the transform to add
-
getNumberOfTransforms
public int getNumberOfTransforms()
- Returns:
- the number of transforms currently chained in this transform process
-
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
-
leanTransforms
public void leanTransforms(DataSet dataSet)
Learns the transforms for the given data set. The data set will not be altered. Once finished, this DataTransformProcess can be applied to the dataSet to get the transformed data set.- Parameters:
dataSet- the data set to learn a series of transforms from
-
learnApplyTransforms
public void learnApplyTransforms(DataSet dataSet)
Learns the transforms for the given data set. The data set is then altered after each transform is learned so the next transform can be learned as well.
The results are equivalent to callinglearnApplyTransforms(jsat.DataSet)on the data set and then callingDataSet.applyTransform(jsat.datatransform.DataTransform)with this DataTransformProces.- Parameters:
dataSet- the data set to learn a series of transforms from and alter into the final transformed form
-
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 DataTransformProcess clone()
- Specified by:
clonein interfaceDataTransform- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG