Normalization
Data normalization in DataVec — normalizer implementations and serialization
NormalizerStandardize
x_normalized = (x - mean) / stdimport org.nd4j.linalg.dataset.api.preprocessor.NormalizerStandardize;
// 1. Create normalizer
NormalizerStandardize normalizer = new NormalizerStandardize();
// 2. Fit on training data (scans all batches to compute mean and std per feature)
normalizer.fit(trainIterator);
// 3. Attach to iterators — normalization is applied automatically on each next() call
trainIterator.reset();
trainIterator.setPreProcessor(normalizer);
// Apply the same normalizer (with the same statistics) to validation data
valIterator.setPreProcessor(normalizer);
// 4. Train
model.fit(trainIterator);Reverting Predictions
NormalizerMinMaxScaler
ImagePreProcessingScaler
MultiNormalizerStandardize
MultiNormalizerMinMaxScaler
MultiNormalizerHybrid
CompositeDataSetPreProcessor
VGG16ImagePreProcessor
Serializing Normalizers
Using NormalizerSerializer Directly
Choosing a Normalizer
Scenario
Recommended Normalizer
Common Mistakes
Last updated
Was this helpful?