Click here to Skip to main content
15,891,431 members
Articles / Programming Languages / Java

Benchmarking and Comparing Encog, Neuroph and JOONE Neural Networks

Rate me:
Please Sign up or sign in to vote.
4.89/5 (8 votes)
3 Jun 2010LGPL38 min read 68.7K   971   14  
I compare the performance of Encog, Neuroph and JOONE
import org.encog.neural.activation.ActivationSigmoid;
import org.encog.neural.data.NeuralDataSet;
import org.encog.neural.data.basic.BasicNeuralDataSet;
import org.encog.neural.networks.BasicNetwork;
import org.encog.neural.networks.layers.BasicLayer;
import org.encog.neural.networks.logic.FeedforwardLogic;
import org.encog.neural.networks.training.Train;
import org.encog.neural.networks.training.propagation.back.Backpropagation;
import org.encog.util.logging.Logging;

public class BenchmarkEncog implements Benchmarkable {

	private BasicNetwork network;
	private NeuralDataSet trainingSet;
	private Backpropagation train;
	private int threadCount;

	public BenchmarkEncog(int threadCount)
	{
		this.threadCount = threadCount;
	}


	@Override
	public double benchmark(int iterations) {
		// train the neural network

		int epoch = 1;

		do {
			train.iteration();
			epoch++;
		} while (epoch <= Benchmark.ITERATIONS );

		return 0;
	}

	@Override
	public void prepareBenchmark(double[][] input, double[][] ideal) {
		// construct a network
		this.network = new BasicNetwork();
		network.addLayer(new BasicLayer(new ActivationSigmoid(),true,Benchmark.INPUT_COUNT));
		network.addLayer(new BasicLayer(new ActivationSigmoid(),true,Benchmark.HIDDEN_COUNT));
		network.addLayer(new BasicLayer(new ActivationSigmoid(),true,Benchmark.OUTPUT_COUNT));
		network.setLogic(new FeedforwardLogic());
		network.getStructure().finalizeStructure();
		network.reset();

		// construct training data
		this.trainingSet = new BasicNeuralDataSet(input, ideal);

		this.train = new Backpropagation(this.network, this.trainingSet,
				Benchmark.LEARNING_RATE, Benchmark.MOMENTUM);
		this.train.setNumThreads(this.threadCount);
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Other Rutgers University
United States United States
Hello, I am a student at Rutgers University. I am in computer science and am learning about machine learning and AI.

Comments and Discussions