Normalization
Neural networks work best when the data they’re fed is normalized, constrained to a range between -1 and 1. There are several reasons for that. One is that nets are trained using gradient descent, and their activation functions usually having an active range somewhere between -1 and 1. Even when using an activation function that doesn’t saturate quickly, it is still good practice to constrain your values to this range to improve performance.
Pre processor for DataSets that normalizes feature values (and optionally label values) to lie between a minimum and maximum value (by default between 0 and 1)
NormalizerMinMaxScaler
public NormalizerMinMaxScaler(double minRange, double maxRange)
Preprocessor can take a range as minRange and maxRange
- param minRange
- param maxRange
load
public void load(File... statistics) throws IOException
Load the given min and max
- param statistics the statistics to load
- throws IOException
save
public void save(File... files) throws IOException
Save the current min and max
- param files the statistics to save
- throws IOException
- deprecated use {- link NormalizerSerializer instead}
Base interface for all normalizers
A DataSetPreProcessor used to flatten a 4d CNN features array to a flattened 2d format (for use in networks such as a DenseLayer/multi-layer perceptron)
statistics of the upper and lower bounds of the population
MinMaxStrategy
public MinMaxStrategy(double minRange, double maxRange)
- param minRange the target range lower bound
- param maxRange the target range upper bound
preProcess
public void preProcess(INDArray array, INDArray maskArray, MinMaxStats stats)
Normalize a data array
- param array the data to normalize
- param stats statistics of the data population
revert
public void revert(INDArray array, INDArray maskArray, MinMaxStats stats)
Denormalize a data array
- param array the data to denormalize
- param stats statistics of the data population
Created by susaneraly on 6/23/16. A preprocessor specifically for images that applies min max scaling Can take a range, so pixel values can be scaled from 0->255 to minRange->maxRange default minRange = 0 and maxRange = 1; If pixel values are not 8 bits, you can specify the number of bits as the third argument in the constructor For values that are already floating point, specify the number of bits as 1
ImagePreProcessingScaler
public ImagePreProcessingScaler(double a, double b, int maxBits)
Preprocessor can take a range as minRange and maxRange
- param a, default = 0
- param b, default = 1
- param maxBits in the image, default = 8
fit
public void fit(DataSet dataSet)
Fit a dataset (only compute based on the statistics from this dataset0
- param dataSet the dataset to compute on
fit
public void fit(DataSetIterator iterator)
Iterates over a dataset accumulating statistics for normalization
- param iterator the iterator to use for collecting statistics.
transform
public void transform(DataSet toPreProcess)
Transform the data
- param toPreProcess the dataset to transform
A simple Composite MultiDataSetPreProcessor - allows you to apply multiple MultiDataSetPreProcessors sequentially on the one MultiDataSet, in the order they are passed to the constructor
CompositeMultiDataSetPreProcessor
public CompositeMultiDataSetPreProcessor(MultiDataSetPreProcessor... preProcessors)
- param preProcessors Preprocessors to apply. They will be applied in this order
Pre processor for MultiDataSet that normalizes feature values (and optionally label values) to lie between a minimum and maximum value (by default between 0 and 1)
MultiNormalizerMinMaxScaler
public MultiNormalizerMinMaxScaler(double minRange, double maxRange)
Preprocessor can take a range as minRange and maxRange
- param minRange the target range lower bound
- param maxRange the target range upper bound
An interface for multi dataset normalizers. Data normalizers compute some sort of statistics over a MultiDataSet and scale the data in some way.
A preprocessor specifically for images that applies min max scaling to one or more of the feature arrays in a MultiDataSet.
Can take a range, so pixel values can be scaled from 0->255 to minRange->maxRange default minRange = 0 and maxRange = 1; If pixel values are not 8 bits, you can specify the number of bits as the third argument in the constructor For values that are already floating point, specify the number of bits as 1
ImageMultiPreProcessingScaler
public ImageMultiPreProcessingScaler(double a, double b, int maxBits, int[] featureIndices)
Preprocessor can take a range as minRange and maxRange
- param a, default = 0
- param b, default = 1
- param maxBits in the image, default = 8
- param featureIndices Indices of feature arrays to process. If only one feature array is present, this should always be 0
Created by susaneraly, Ede Meijer variance and mean Pre processor for DataSet that normalizes feature values (and optionally label values) to have 0 mean and a standard deviation of 1
load
public void load(File... files) throws IOException
Load the means and standard deviations from the file system
- param files the files to load from. Needs 4 files if normalizing labels, otherwise 2.
save
public void save(File... files) throws IOException
- param files the files to save to. Needs 4 files if normalizing labels, otherwise 2.
- deprecated use {- link NormalizerSerializer} instead
Save the current means and standard deviations to the file system
of the means and standard deviations of the population
preProcess
public void preProcess(INDArray array, INDArray maskArray, DistributionStats stats)
Normalize a data array
- param array the data to normalize
- param stats statistics of the data population
revert
public void revert(INDArray array, INDArray maskArray, DistributionStats stats)
Denormalize a data array
- param array the data to denormalize
- param stats statistics of the data population
Interface for strategies that can normalize and denormalize data arrays based on statistics of the population