A multi-layer (3 layer) fully connected, feed forward network consisting of sigmoidal neurons, trained with stochastic gradient descent and back propagation.
The MNISTNeuralNetwork program is a simple artificial neural network implemented in Java to classify handwritten digits from the MNIST dataset. It includes functionalities to train the network, load pre-trained weights, test its accuracy, and visualize misclassified images.
- Train the neural network using mini-batches and backpropagation.
- Load and save trained weights to a file.
- Display network accuracy on both training and testing datasets.
- Visualize misclassified testing images.
- User-interactive console menu for easy navigation.
- Input Layer: 784 neurons (corresponding to 28x28 pixel grayscale images).
- Hidden Layer: 100 neurons.
- Output Layer: 10 neurons (one for each digit from 0 to 9).
- Activation Function: ReLU for hidden layers, Softmax for the output layer.
- Learning Rate: 0.01.
- Mini-batch Size: 32.
- Epochs: 50.
Upon running the program, the user is prompted to choose between:
- Training the network from scratch.
- Loading a pre-trained network.
- Exiting the program.
After choosing an option, additional functionalities become available, including:
- Retraining the network.
- Displaying accuracy.
- Running the network on test data.
- Viewing misclassified images.
- Saving the network state.
Computes the output of the network given an input image.
Performs the backpropagation algorithm to adjust weights and biases based on error.
Updates network weights and biases after computing errors.
Trains the network using the specified dataset.
Calculates the accuracy of the network on a given dataset.
Saves the trained weights and biases to a file for future use.
Loads saved weights and biases from a file.
Runs the network on testing data and displays the results, including misclassified images.
- Training and testing data should be in CSV format.
- Weight sets are stored in
weightset.csv.
- Java Standard Library (java.io, java.util)
javac MNISTNeuralNetwork.java
java MNISTNeuralNetworkFollow on-screen prompts to train, load, and test the network.