Package ann4j
Class MNISTDataBaseFileReader
java.lang.Object
ann4j.InputFileReader
ann4j.MNISTDataBaseFileReader
-
Field Summary
Modifier and TypeFieldDescriptiondouble
int
Fields inherited from class ann4j.InputFileReader
filename
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThis function is responsible for generating the output neuronsgenerateInputFromBigArray
(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 oneThis function returns the expected output arrayThis function returns the inputArraydouble
getLabel()
This function is responsible for setting the labels of the data.double
getPredictionFromNeuronNum
(int mostSignificantNeuronNumAsPrediction) > This function takes in the most significant neuron number and returns the predictionvoid
next()
It reads the next line of the file, converts it into a two double arrays, and then sets the label and expected output arrayIt 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 doublesvoid
restart()
This function restarts the file reader.
-
Field Details
-
expectedOutputArray
-
inputArray
-
label
public double label -
singleFileReader
-
outputLayerLength
public int outputLayerLength -
fileName
-
-
Constructor Details
-
MNISTDataBaseFileReader
MNISTDataBaseFileReader(String filename, int outputLayerLength) throws FileNotFoundException - Throws:
FileNotFoundException
-
-
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 classInputFileReader
- 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 classInputFileReader
-
readLineToDoubleArray
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
This function returns the expected output array- Overrides:
getExpectedOutputArray
in classInputFileReader
- Returns:
- The expected output array.
-
getInputArray
This function returns the inputArray- Overrides:
getInputArray
in classInputFileReader
- Returns:
- The inputArray is being returned.
-
generateExpectedOutputArrayFromLabel
This function is responsible for generating the output neurons- Returns:
- The expected output array.
-
generateInputFromBigArray
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 classInputFileReader
- 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 classInputFileReader
-