Class AbstractDataSetNormalizer<S extends NormalizerStats>
- java.lang.Object
-
- org.nd4j.linalg.dataset.api.preprocessor.AbstractNormalizer
-
- org.nd4j.linalg.dataset.api.preprocessor.AbstractDataSetNormalizer<S>
-
- All Implemented Interfaces:
Serializable,DataSetPreProcessor,DataNormalization,Normalizer<DataSet>
- Direct Known Subclasses:
NormalizerMinMaxScaler,NormalizerStandardize
public abstract class AbstractDataSetNormalizer<S extends NormalizerStats> extends AbstractNormalizer implements DataNormalization
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected NormalizerStrategy<S>strategy
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDataSetNormalizer(NormalizerStrategy<S> strategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidfit(DataSet dataSet)Fit a dataset (only compute based on the statistics from this dataset)voidfit(DataSetIterator iterator)Fit the given modelvoidfitLabel(boolean fitLabels)Flag to specify if the labels/outputs in the dataset should be also normalized default value is falseprotected SgetFeatureStats()protected SgetLabelStats()protected booleanisFit()booleanisFitLabel()Whether normalization for the labels is also enabled.protected abstract NormalizerStats.BuildernewBuilder()voidpreProcess(@NonNull DataSet toPreProcess)Pre process a datasetvoidrevert(DataSet data)Revert the data to what it was before transformvoidrevertFeatures(INDArray features)Undo (revert) the normalization applied by this DataNormalization instance to the specified features arrayvoidrevertFeatures(INDArray features, INDArray featuresMask)Undo (revert) the normalization applied by this DataNormalization instance to the specified features arrayvoidrevertLabels(INDArray labels)Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.voidrevertLabels(INDArray labels, INDArray labelsMask)Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.voidtransform(INDArray features)Transform the given INDArrayvoidtransform(INDArray features, INDArray featuresMask)Transform the features, with an optional mask arrayvoidtransform(DataSet toPreProcess)Transform the given datasetvoidtransformLabel(INDArray label)Transform the labels.voidtransformLabel(INDArray label, INDArray labelsMask)Transform the labels.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.dataset.api.preprocessor.Normalizer
getType
-
-
-
-
Field Detail
-
strategy
protected NormalizerStrategy<S extends NormalizerStats> strategy
-
-
Constructor Detail
-
AbstractDataSetNormalizer
protected AbstractDataSetNormalizer(NormalizerStrategy<S> strategy)
-
-
Method Detail
-
fitLabel
public void fitLabel(boolean fitLabels)
Flag to specify if the labels/outputs in the dataset should be also normalized default value is false- Specified by:
fitLabelin interfaceDataNormalization- Parameters:
fitLabels-
-
isFitLabel
public boolean isFitLabel()
Whether normalization for the labels is also enabled. Most commonly used for regression, not classification.- Specified by:
isFitLabelin interfaceDataNormalization- Returns:
- True if labels will be
-
fit
public void fit(DataSet dataSet)
Fit a dataset (only compute based on the statistics from this dataset)- Specified by:
fitin interfaceNormalizer<S extends NormalizerStats>- Parameters:
dataSet- the dataset to compute on
-
getFeatureStats
protected S getFeatureStats()
-
getLabelStats
protected S getLabelStats()
-
isFit
protected boolean isFit()
- Specified by:
isFitin classAbstractNormalizer
-
fit
public void fit(DataSetIterator iterator)
Fit the given model- Specified by:
fitin interfaceDataNormalization- Parameters:
iterator- for the data to iterate over
-
newBuilder
protected abstract NormalizerStats.Builder newBuilder()
-
preProcess
public void preProcess(@NonNull @NonNull DataSet toPreProcess)Pre process a dataset- Specified by:
preProcessin interfaceDataNormalization- Specified by:
preProcessin interfaceDataSetPreProcessor- Parameters:
toPreProcess- the data set to pre process
-
transform
public void transform(DataSet toPreProcess)
Transform the given dataset- Specified by:
transformin interfaceNormalizer<S extends NormalizerStats>- Parameters:
toPreProcess-
-
transform
public void transform(INDArray features)
Transform the given INDArray- Specified by:
transformin interfaceDataNormalization- Parameters:
features-
-
transform
public void transform(INDArray features, INDArray featuresMask)
Description copied from interface:DataNormalizationTransform the features, with an optional mask array- Specified by:
transformin interfaceDataNormalization- Parameters:
features- the features to pre processfeaturesMask- the mask array to pre process
-
transformLabel
public void transformLabel(INDArray label)
Transform the labels. IfisFitLabel()== false, this is a no-op- Specified by:
transformLabelin interfaceDataNormalization
-
transformLabel
public void transformLabel(INDArray label, INDArray labelsMask)
Description copied from interface:DataNormalizationTransform the labels. IfDataNormalization.isFitLabel()== false, this is a no-op- Specified by:
transformLabelin interfaceDataNormalization
-
revertFeatures
public void revertFeatures(INDArray features)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified features array- Specified by:
revertFeaturesin interfaceDataNormalization- Parameters:
features- Features to revert the normalization on
-
revertFeatures
public void revertFeatures(INDArray features, INDArray featuresMask)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified features array- Specified by:
revertFeaturesin interfaceDataNormalization- Parameters:
features- Features to revert the normalization on
-
revertLabels
public void revertLabels(INDArray labels)
Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array. If labels normalization is disabled (i.e.,isFitLabel()== false) then this is a no-op. Can also be used to undo normalization for network output arrays, in the case of regression.- Specified by:
revertLabelsin interfaceDataNormalization- Parameters:
labels- Labels array to revert the normalization on
-
revertLabels
public void revertLabels(INDArray labels, INDArray labelsMask)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified labels array. If labels normalization is disabled (i.e.,#isFitLabels()== false) then this is a no-op. Can also be used to undo normalization for network output arrays, in the case of regression.- Specified by:
revertLabelsin interfaceDataNormalization- Parameters:
labels- Labels array to revert the normalization onlabelsMask- Labels mask array (may be null)
-
revert
public void revert(DataSet data)
Revert the data to what it was before transform- Specified by:
revertin interfaceNormalizer<S extends NormalizerStats>- Parameters:
data- the dataset to revert back
-
-