GeniusOfEvil’s Blog

It is a sin to believe evil of others, but it is seldom a mistake.

Neural Networks in Java, Backpropagation algorithm for layered networks

leave a comment »

During the last few weeks I’ve been programming a lot, mostly in Java. Was my code efficient? I guess so. And it worked. What more can man want ? Beauty! l I needed was to change my programming style.

So I started all over again and rewritten the most of the code from scratch.

I began with activation function

public interface Function {
     double valueOf(double x);
public interface ActivationFunction extends Function{
     Function getDerivative();
public class Sigmoid implements ActivationFunction {
     double valueOf(double x) {
          return 1 / (1 + Math.exp(-x));
     Function getDerivative() {
          return new Function() {
               public double valueOf(double f) {
                    return f * ( 1 - f);

Then I needed a matrix and a vector. Unfortunately, all the implementations I’ve seen were’nt too pretty. So I followed the

If you want a thing done well, do it yourself


To Be Continued


Written by Jarek Przygódzki

March 18, 2009 at 1:29 pm

Posted in Java

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: