Package ann4j
Class MNISTDataBaseFileReader
java.lang.Object
ann4j.InputFileReader
ann4j.MNISTDataBaseFileReader
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleintFields inherited from class ann4j.InputFileReader
filename -
Constructor Summary
Constructors -
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 inputArraydoublegetLabel()This function is responsible for setting the labels of the data.doublegetPredictionFromNeuronNum(int mostSignificantNeuronNumAsPrediction) > This function takes in the most significant neuron number and returns the predictionvoidnext()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 doublesvoidrestart()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:
getLabelin 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:
nextin 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:
getExpectedOutputArrayin classInputFileReader- Returns:
- The expected output array.
-
getInputArray
This function returns the inputArray- Overrides:
getInputArrayin 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:
getPredictionFromNeuronNumin 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:InputFileReaderThis function restarts the file reader.- Overrides:
restartin classInputFileReader
-