Package ann4j

Class MNISTDataBaseFileReader

java.lang.Object
ann4j.InputFileReader
ann4j.MNISTDataBaseFileReader

public class MNISTDataBaseFileReader extends InputFileReader
  • Field Details

    • expectedOutputArray

      public ArrayList<Double> expectedOutputArray
    • inputArray

      public ArrayList<Double> inputArray
    • label

      public double label
    • singleFileReader

      public BufferedReader singleFileReader
    • outputLayerLength

      public int outputLayerLength
    • fileName

      public String fileName
  • Constructor Details

  • Method Details

    • getLabel

      public double getLabel()
      This function is responsible for setting the labels of the data. This depends on the data set
      Overrides:
      getLabel in class InputFileReader
      Returns:
      The label of the data.
    • next

      public void next()
      It reads the next line of the file, converts it into a two double arrays, and then sets the label and expected output array
      Overrides:
      next in class InputFileReader
    • readLineToDoubleArray

      public ArrayList<Double> readLineToDoubleArray() throws IOException
      It reads the next line of the file, splits it into an array of strings, and then converts that array of strings into an array of doubles
      Returns:
      An ArrayList of Doubles.
      Throws:
      IOException
    • getExpectedOutputArray

      public ArrayList<Double> getExpectedOutputArray()
      This function returns the expected output array
      Overrides:
      getExpectedOutputArray in class InputFileReader
      Returns:
      The expected output array.
    • getInputArray

      public ArrayList<Double> getInputArray()
      This function returns the inputArray
      Overrides:
      getInputArray in class InputFileReader
      Returns:
      The inputArray is being returned.
    • generateExpectedOutputArrayFromLabel

      public ArrayList<Double> generateExpectedOutputArrayFromLabel()
      This function is responsible for generating the output neurons
      Returns:
      The expected output array.
    • generateInputFromBigArray

      public ArrayList<Double> generateInputFromBigArray(ArrayList<Double> array)
      It takes the array of all the values in the dataset and returns an array of all the values except the first one
      Parameters:
      array - The array that contains the data.
      Returns:
      The input array is being returned.
    • getPredictionFromNeuronNum

      public double getPredictionFromNeuronNum(int mostSignificantNeuronNumAsPrediction)
      Description copied from class: InputFileReader
      > This function takes in the most significant neuron number and returns the prediction
      Overrides:
      getPredictionFromNeuronNum in class InputFileReader
      Parameters:
      mostSignificantNeuronNumAsPrediction - The neuron number that has the highest activation value.
      Returns:
      The prediction from the most significant neuron number.
    • restart

      public void restart()
      Description copied from class: InputFileReader
      This function restarts the file reader.
      Overrides:
      restart in class InputFileReader