Archive for the ‘Java’ Category
Neural Networks in Java, Backpropagation algorithm for layered networks
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
rule.
To Be Continued