Skip to content

422053362-duplicate/MultilayerPerceptron

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

MultilayerPerceptron

Simple java ANN Multilayer Perceptrom (MLP).

Artificial Neural Network based on Multilayer Perceptron using EJML library for matrix management (the jar file is available here).

Algorithm based on Chapter 3 and Appendix A of the book Practical Neural Networks and Genetic Algorithms. If you want to learn more about this stuff, I recomend you to take a look to the book.

How to use

Currently the threeshold activation is not available (that's a bug pendent to fix). But you can use sigmoid activation for your purposes. If you take a look to the source code, for using a MLP the only thing you need to do is to create an ANN object:

// 2 inputs, 3 hidden neurons, 1 output, 1 hidden layer, 1.0 learning rate, activation function
ANN myNeuralNetwork = new ANN(2, 3, 1, 1, 1.0, ANN.ACTIVATION_SIGMOID);

An then to train the neural network just call train method:

// Input vector, target vector, minimum operations, maximum error
myNeuralNetwork.train(input, target, 10000, 0.01);

The format of the input labeled data for training should be:

-- --                                 -- --
| input1[0]   input2[0]   ... inputN[0]   | 
| input1[1]   input2[1]   ... inputN[1]   | 
|    |            |               |       |  
| input1[M-1] input2[M-1] ... inputN[M-1] |
-- --                                 -- --

Where as you can see, in the double array:

[i][j] i->Input j->Number of input

After the nerual network has been trained, you will be able to classify your data. For this purpose, you can use the classify function:

output = myNeuralNetwork.classify(input);

And that's all!

Contributions

Please, feel free to collaborate or give me some feedback. Hope this code help you!

Practical Neural Networks and Genetic Algorithms

It is available online on Robert Gordon University Aberdeen:

About

Simple java ANN Multilayer Perceptrom (MLP).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%