Skip to content

A simple, unfinished java implementation of a rudimentary artificial intelligence framework, trained using the MNIST data set for the classification of numbers.

License

Notifications You must be signed in to change notification settings

KlotzJesse/neuralnetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neuralnetwork logo

neuralnetwork

A simple, unfinished java implementation of a rudimentary artificial intelligence framework written in java, trained using the MNIST data set for the classification of numbers.

What is Artifical Intelligence

For the present purpose the artificial intelligence problem is taken to be that of making a machine behave in ways that would be called intelligent if a human were so behaving.

-- John McCarthy, 1955, known as the father of AI
    firstly coined the term "artificial intelligence" (aka A PROPOSAL FOR THE DARTMOUTH SUMMER RESEARCH PROJECT ON ARTIFICIAL INTELLIGENCE)

CircleCI Docker Image Size (latest by date) Libraries.io dependency status for GitHub repo GitHub code size in bytes GitHub repo size GitHub

Run MNIST-Training example network

Prerequisities

In order to run this container you'll need docker installed.

Install

Pull jesseklotz2306/neuralnetwork from the Docker repository:

docker pull jesseklotz2306/neuralnetwork

Run

Run the image:

docker run jesseklotz2306/neuralnetwork

Usage

Setup

Two hidden layer configuration (add as many as you want). Using the Swish activation function and an exponential rectifier as activation function. Outputs a probability distribution in relation to the plausibility of the input value.

Input Neurons: 720, Hidden Layer 1: 28, Hidden Layer 2: 14, Output Neurons: 10

Every neuron is by default densely connected to each other (synapses) and initialized using the Xavier Initializer.

NeuronalNetwork neuralNetwork = new NeuronalNetworkBuilder()
                .layer(720, ActivationFunction.IDENTITY)
                .layer(28, ActivationFunction.SWISH_RECTIFIER)
                .layer(14, ActivationFunction.EXPONENTIAL_RECTIFIER)
                .layer(10, ActivationFunction.SOFTMAX)
                .initializer(Initializer.XAVIER_INITIALIZER)
                .build();

The network is capable of carrying out the learning process using various learning techniques. At the moment just Backpropagation is implemented.

Strategy backPropagation = new StrategyBuilder(new BackPropagation())
                            .learningRate(0.2f)
                            .momentum(0.9f)
                            .regularization(new Dropout())
                            .neuronalNetwork(network)
                            .build();

Training

/*Set Input Data*/
network.input(/* Input Data [784-Dimensions] */);

int outputLayerSize = network.layers.getLast().size();

/*Initialize output matrix for expected size*/
float[] out = new float[outputLayerSize];
for (int i = 0; i < outputLayerSize; i++) {
    out[i] = 0;
}

/*Set winning Output Neuron, e.g. number 3*/
out[3] = 1.0f;

/*Set expected Output Matrix*/
network.setAnticipatedOutput(out);

/*Let network train*/
backPropagation.learn();

License

GitHub

About

A simple, unfinished java implementation of a rudimentary artificial intelligence framework, trained using the MNIST data set for the classification of numbers.

Topics

Resources

License

Stars

Watchers

Forks

Languages