Class MnistDataSetIterator

  • All Implemented Interfaces:
    Serializable, Iterator<org.nd4j.linalg.dataset.DataSet>, org.nd4j.linalg.dataset.api.iterator.DataSetIterator

    public class MnistDataSetIterator
    extends org.nd4j.linalg.dataset.api.iterator.BaseDatasetIterator
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.nd4j.linalg.dataset.api.iterator.BaseDatasetIterator

        batch, fetcher, numExamples, preProcessor, topLevelDir
    • Constructor Summary

      Constructors 
      Constructor Description
      MnistDataSetIterator​(int batchSize, boolean train, int seed)
      Constructor to get the full MNIST data set (either test or train sets) without binarization (i.e., just normalization into range of 0 to 1), with shuffling based on a random seed.
      MnistDataSetIterator​(int batch, int numExamples)  
      MnistDataSetIterator​(int batch, int numExamples, boolean binarize)
      Get the specified number of examples for the MNIST training data set.
      MnistDataSetIterator​(int batch, int numExamples, boolean binarize, boolean train, boolean shuffle, long rngSeed)
      Get the specified number of MNIST examples (test or train set), with optional shuffling and binarization.
      MnistDataSetIterator​(int batch, int numExamples, boolean binarize, boolean train, boolean shuffle, long rngSeed, File topLevelDir)
      Get the specified number of MNIST examples (test or train set), with optional shuffling and binarization.
    • Constructor Detail

      • MnistDataSetIterator

        public MnistDataSetIterator​(int batch,
                                    int numExamples)
                             throws IOException
        Throws:
        IOException
      • MnistDataSetIterator

        public MnistDataSetIterator​(int batch,
                                    int numExamples,
                                    boolean binarize)
                             throws IOException
        Get the specified number of examples for the MNIST training data set.
        Parameters:
        batch - the batch size of the examples
        numExamples - the overall number of examples
        binarize - whether to binarize mnist or not
        Throws:
        IOException
      • MnistDataSetIterator

        public MnistDataSetIterator​(int batchSize,
                                    boolean train,
                                    int seed)
                             throws IOException
        Constructor to get the full MNIST data set (either test or train sets) without binarization (i.e., just normalization into range of 0 to 1), with shuffling based on a random seed.
        Parameters:
        batchSize -
        train -
        Throws:
        IOException
      • MnistDataSetIterator

        public MnistDataSetIterator​(int batch,
                                    int numExamples,
                                    boolean binarize,
                                    boolean train,
                                    boolean shuffle,
                                    long rngSeed)
                             throws IOException
        Get the specified number of MNIST examples (test or train set), with optional shuffling and binarization.
        Parameters:
        batch - Size of each patch
        numExamples - total number of examples to load
        binarize - whether to binarize the data or not (if false: normalize in range 0 to 1)
        train - Train vs. test set
        shuffle - whether to shuffle the examples
        rngSeed - random number generator seed to use when shuffling examples
        Throws:
        IOException
      • MnistDataSetIterator

        public MnistDataSetIterator​(int batch,
                                    int numExamples,
                                    boolean binarize,
                                    boolean train,
                                    boolean shuffle,
                                    long rngSeed,
                                    File topLevelDir)
                             throws IOException
        Get the specified number of MNIST examples (test or train set), with optional shuffling and binarization.
        Parameters:
        batch - Size of each patch
        numExamples - total number of examples to load
        binarize - whether to binarize the data or not (if false: normalize in range 0 to 1)
        train - Train vs. test set
        shuffle - whether to shuffle the examples
        rngSeed - random number generator seed to use when shuffling examples
        Throws:
        IOException
    • Method Detail

      • close

        public void close()