org.apache.ignite.ml.util

## Class MnistUtils

- java.lang.Object
- - org.apache.ignite.ml.util.MnistUtils

-     public class MnistUtils
      extends Object

  Utility class for reading MNIST dataset.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MnistUtils.MnistImage` MNIST image.
    `static class` | `MnistUtils.MnistLabeledImage` MNIST labeled image.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MnistUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `asLIBSVM(String imagesPath, String labelsPath, String outPath, Random rnd, int cnt)` Convert random `count` samples from MNIST dataset from two files (images and labels) into libsvm format.
    `static List<MnistUtils.MnistLabeledImage>` | `mnistAsList(String imagesPath, String labelsPath, Random rnd, int cnt)` Read random `count` samples from MNIST dataset from two files (images and labels) into a stream of labeled vectors.
    `static List<MnistUtils.MnistLabeledImage>` | `mnistAsListFromResource(String imagesPath, String labelsPath, Random rnd, int cnt)` Read random `count` samples from MNIST dataset from two resources (images and labels) into a stream of labeled vectors.
    `static Stream<DenseVector>` | `mnistAsStream(String imagesPath, String labelsPath, Random rnd, int cnt)` Read random `count` samples from MNIST dataset from two files (images and labels) into a stream of labeled vectors.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MnistUtils

          public MnistUtils()

  - ### Method Detail

    - #### mnistAsStream

          public static Stream<DenseVector> mnistAsStream(String imagesPath,
                                                          String labelsPath,
                                                          Random rnd,
                                                          int cnt)
                                                   throws IOException

      Read random `count` samples from MNIST dataset from two files (images and labels) into a stream of labeled vectors.
      Parameters:
        `imagesPath` - Path to the file with images.
        `labelsPath` - Path to the file with labels.
        `rnd` - Random numbers generator.
        `cnt` - Count of samples to read.
      Returns:
        Stream of MNIST samples.
      Throws:
        `IgniteException` - In case of exception.
        `IOException`

    - #### mnistAsList

          public static List<MnistUtils.MnistLabeledImage> mnistAsList(String imagesPath,
                                                                       String labelsPath,
                                                                       Random rnd,
                                                                       int cnt)
                                                                throws IOException

      Read random `count` samples from MNIST dataset from two files (images and labels) into a stream of labeled vectors.
      Parameters:
        `imagesPath` - Path to the file with images.
        `labelsPath` - Path to the file with labels.
        `rnd` - Random numbers generator.
        `cnt` - Count of samples to read.
      Returns:
        List of MNIST samples.
      Throws:
        `IOException` - In case of exception.

    - #### mnistAsListFromResource

          public static List<MnistUtils.MnistLabeledImage> mnistAsListFromResource(String imagesPath,
                                                                                   String labelsPath,
                                                                                   Random rnd,
                                                                                   int cnt)
                                                                            throws IOException

      Read random `count` samples from MNIST dataset from two resources (images and labels) into a stream of labeled vectors.
      Parameters:
        `imagesPath` - Path to the resource with images.
        `labelsPath` - Path to the resource with labels.
        `rnd` - Random numbers generator.
        `cnt` - Count of samples to read.
      Returns:
        List of MNIST samples.
      Throws:
        `IOException` - In case of exception.

    - #### asLIBSVM

          public static void asLIBSVM(String imagesPath,
                                      String labelsPath,
                                      String outPath,
                                      Random rnd,
                                      int cnt)
                               throws IOException

      Convert random `count` samples from MNIST dataset from two files (images and labels) into libsvm format.
      Parameters:
        `imagesPath` - Path to the file with images.
        `labelsPath` - Path to the file with labels.
        `outPath` - Path to output path.
        `rnd` - Random numbers generator.
        `cnt` - Count of samples to read.
      Throws:
        `IgniteException` - In case of exception.
        `IOException`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020