1. Zdeněk Drahoš
  2. JAVA Neural Networks

Overview

JAVA Neural Networks

About

Project developed as semestral project in Introduction to Artificial Intelligence at University of Pardubice.

  • Kohonen map - self organized map for data classification.
  • Feed Forward neural network
  • Back Propagation - training algorithm for feedforward neural networks.

GUI application

You can import your data in CSV format to application. The data can be used for classification into selected number of groups with Kohonen Map and you can display graph for 2D data. Or you can approximate data with a neural network, which will be trained with Back Propagation algorithm.

Import CSV example Kohonen map example Back propagation exampl

Example code

Classifying data with Kohonen map

Double[][] inputData = new Double[][]{
    {1.0, 2.0, ...}, 
    {2.0, 5.5, ...},
    ...
};
double learningRate = 0.75;
int groupsCount = 2;
int iterationsCount = 500;

IKohonenMap kohonenMap = new KohonenMap();
kohonenMap.setData(inputData);
kohonenMap.train(learningRate, numberOfGroups, numberOfIterations);
kohonenMap.classifyData();
kohonenMap.sortClassifiedData();
List<List<Double[]>> result = kohonenMap.getClassifiedData();

Training feedforward neural network

// Build feedforward neural network
int[] topology = {2, 2, 1};
Activations[] activations = {Activations.LIN, Activations.SIG,
                         Activations.LIN};
INetworkBuilder networkBuilder = new NetworkBuilder();
INeuralNetwork network = networkBuilder.build(topology, activations);

// Input
TrainingInput input = new TrainingInput();
input.iterationsCount = 1000;
input.learningRate = 0.2;
input.momentum = 0;
input.inputs = new double[][] { {0, 0}, ... };
input.targets = new double[][] { {1}, ... };

// Output 
double errorToleration = 0.0005;
TrainingOutput output = new TrainingOutput(errorToleration);

// Init training - sets training algorithm, data separator, etc.
ITrainingBuilder trainBuilder = new TrainingBuilder();
ITraining training = trainBuilder.build();

// Train network and simulate data with network
training.train(network, input, output);
double[] inputPattern = {0,0};
train.simulate(inputPattern);

Used libraries

Facts

License: New BSD License.

Author: Zdenek Drahos.