Class AbstractMultiDataSetNormalizer<S extends NormalizerStats>
- java.lang.Object
-
- org.nd4j.linalg.dataset.api.preprocessor.AbstractNormalizer
-
- org.nd4j.linalg.dataset.api.preprocessor.AbstractMultiDataSetNormalizer<S>
-
- All Implemented Interfaces:
Serializable
,MultiDataSetPreProcessor
,MultiDataNormalization
,Normalizer<MultiDataSet>
- Direct Known Subclasses:
MultiNormalizerMinMaxScaler
,MultiNormalizerStandardize
public abstract class AbstractMultiDataSetNormalizer<S extends NormalizerStats> extends AbstractNormalizer implements MultiDataNormalization
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected NormalizerStrategy<S>
strategy
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMultiDataSetNormalizer()
protected
AbstractMultiDataSetNormalizer(NormalizerStrategy<S> strategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
fit(@NonNull MultiDataSetIterator iterator)
Fit an iteratorvoid
fit(@NonNull MultiDataSet dataSet)
Fit a MultiDataSet (only compute based on the statistics from thisMultiDataSet
)void
fitLabel(boolean fitLabels)
Flag to specify if the labels/outputs in the dataset should be also normalized default value is falseprotected List<S>
getFeatureStats()
protected S
getFeatureStats(int input)
protected List<S>
getLabelStats()
protected S
getLabelStats(int output)
protected boolean
isFit()
boolean
isFitLabel()
Whether normalization for the labels is also enabled.protected abstract NormalizerStats.Builder
newBuilder()
int
numInputs()
Get the number of inputsint
numOutputs()
Get the number of outputsvoid
preProcess(@NonNull MultiDataSet toPreProcess)
Pre process a MultiDataSetvoid
revert(@NonNull MultiDataSet data)
Revert the data to what it was before transformvoid
revertFeatures(@NonNull INDArray[] features)
Undo (revert) the normalization applied by this normalizer to the features arraysvoid
revertFeatures(@NonNull INDArray[] features, INDArray[] maskArrays)
Undo (revert) the normalization applied by this normalizer to the features arraysvoid
revertFeatures(@NonNull INDArray features, INDArray mask, int input)
Undo (revert) the normalization applied by this normalizer to a specific features array.void
revertLabels(@NonNull INDArray[] labels, INDArray[] labelsMask)
Undo (revert) the normalization applied by this normalizer to the labels arrays.void
revertLabels(@NonNull INDArray labels, INDArray mask, int output)
Undo (revert) the normalization applied by this normalizer to a specific labels array.void
revertLabels(INDArray[] labels)
Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.void
transform(@NonNull MultiDataSet toPreProcess)
Transform the dataset-
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
-
AbstractMultiDataSetNormalizer
protected AbstractMultiDataSetNormalizer()
-
AbstractMultiDataSetNormalizer
protected AbstractMultiDataSetNormalizer(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- Parameters:
fitLabels
-
-
isFitLabel
public boolean isFitLabel()
Whether normalization for the labels is also enabled. Most commonly used for regression, not classification.- Returns:
- True if labels will be
-
isFit
protected boolean isFit()
- Specified by:
isFit
in classAbstractNormalizer
-
getFeatureStats
protected S getFeatureStats(int input)
-
getLabelStats
protected S getLabelStats(int output)
-
fit
public void fit(@NonNull @NonNull MultiDataSet dataSet)
Fit a MultiDataSet (only compute based on the statistics from thisMultiDataSet
)- Specified by:
fit
in interfaceNormalizer<S extends NormalizerStats>
- Parameters:
dataSet
- the dataset to compute on
-
fit
public void fit(@NonNull @NonNull MultiDataSetIterator iterator)
Fit an iterator- Specified by:
fit
in interfaceMultiDataNormalization
- Parameters:
iterator
- for the data to iterate over
-
newBuilder
protected abstract NormalizerStats.Builder newBuilder()
-
transform
public void transform(@NonNull @NonNull MultiDataSet toPreProcess)
Description copied from interface:Normalizer
Transform the dataset- Specified by:
transform
in interfaceNormalizer<S extends NormalizerStats>
- Parameters:
toPreProcess
- the dataset to re process
-
preProcess
public void preProcess(@NonNull @NonNull MultiDataSet toPreProcess)
Pre process a MultiDataSet- Specified by:
preProcess
in interfaceMultiDataNormalization
- Specified by:
preProcess
in interfaceMultiDataSetPreProcessor
- Parameters:
toPreProcess
- the data set to pre process
-
revert
public void revert(@NonNull @NonNull MultiDataSet data)
Revert the data to what it was before transform- Specified by:
revert
in interfaceNormalizer<S extends NormalizerStats>
- Parameters:
data
- the dataset to revert back
-
revertFeatures
public void revertFeatures(@NonNull @NonNull INDArray[] features)
Undo (revert) the normalization applied by this normalizer to the features arrays- Specified by:
revertFeatures
in interfaceMultiDataNormalization
- Parameters:
features
- Features to revert the normalization on
-
revertFeatures
public void revertFeatures(@NonNull @NonNull INDArray[] features, INDArray[] maskArrays)
Undo (revert) the normalization applied by this normalizer to the features arrays- Specified by:
revertFeatures
in interfaceMultiDataNormalization
- Parameters:
features
- Features to revert the normalization on
-
revertFeatures
public void revertFeatures(@NonNull @NonNull INDArray features, INDArray mask, int input)
Undo (revert) the normalization applied by this normalizer to a specific features 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.- Parameters:
features
- features arrays to revert the normalization oninput
- the index of the array to revert
-
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:
revertLabels
in interfaceMultiDataNormalization
- Parameters:
labels
- Labels array to revert the normalization on
-
revertLabels
public void revertLabels(@NonNull @NonNull INDArray[] labels, INDArray[] labelsMask)
Undo (revert) the normalization applied by this normalizer to the labels arrays. 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:
revertLabels
in interfaceMultiDataNormalization
- Parameters:
labels
- Labels arrays to revert the normalization onlabelsMask
- Labels mask array (may be null)
-
revertLabels
public void revertLabels(@NonNull @NonNull INDArray labels, INDArray mask, int output)
Undo (revert) the normalization applied by this normalizer to a specific 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.- Parameters:
labels
- Labels arrays to revert the normalization onoutput
- the index of the array to revert
-
numInputs
public int numInputs()
Get the number of inputs
-
numOutputs
public int numOutputs()
Get the number of outputs
-
-