# HG changeset patch # User revcompgeek # Date 1208058937 21600 # Node ID 73beed4844556df9e7657e5dab75bb8abc78dbc9 # Parent 314d68bafefff1624509a3f422cddc4890affd90 Backprop working correctly. diff -r 314d68bafeff -r 73beed484455 trunk/aid/nn/multilayer/backprop.d --- a/trunk/aid/nn/multilayer/backprop.d Fri Apr 11 18:12:55 2008 -0600 +++ b/trunk/aid/nn/multilayer/backprop.d Sat Apr 12 21:55:37 2008 -0600 @@ -4,19 +4,22 @@ import aid.misc; import std.random; import std.stream; +import std.stdio; class Backprop { private uint numInputs; - private float[][][] units; // Includes the output units. units[layer][unit][inputWeight] + private double[][][] units; // Includes the output units. units[layer][unit][inputWeight] private OutputFunctionPtr[] functions; - public float learningRate; + public double learningRate; ///Constructor - public this(uint numInputs,uint[] numUnits,OutputFunctionPtr[] functions,float value=0.05,bool randomize=true){ + public this(uint numInputs,uint[] numUnits,OutputFunctionPtr[] functions,double learningRate=0.03,double value=0.1,bool randomize=true){ if(numUnits.length == 0) throw new InputException("numUnits must be greater than 0"); if(numUnits.length != functions.length) throw new InputException("numUnits and functions must be the same length"); this.numInputs = numInputs; this.functions = functions; + this.learningRate = learningRate; + units.length = numUnits.length; initUnitLayer(0,numUnits[0],numInputs,value,randomize); for(int i=1; i