How it works...

To start, you need to have an iterator to traverse and prepare the data. In step 1, we used the record reader data to create the dataset iterator. The purpose of the iterator is to have more control over the data and how it is presented to the neural network.

Once the appropriate normalization method has been identified (NormalizerStandardize, in step 2), we use fit() to apply the normalization to the dataset. NormalizerStandardize normalizes the data in such a way that feature values will have a zero mean and standard deviation of 1.

The example for this recipe can be found at https://github.com/PacktPublishing/Java-Deep-Learning-Cookbook/blob/master/02_Data_Extraction_Transform_and_Loading/sourceCode/cookbook-app/src/main/java/com/javadeeplearningcookbook/app/NormalizationExample.java.

  • Sample input: A dataset iterator that holds feature variables (INDArray format). Iterators are created from the input data as mentioned in previous recipes.
  • Sample output: Refer to the following snapshot for the normalized features (INDArray format) after applying normalization on the input data:

Note that we can't skip step 3 while applying normalization. If we don't perform step 3, the dataset won't be auto-normalized. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset