Mercurial > projects > aid
view trunk/aid/misc.d @ 5:810d58835f86
Added momentum and stochastic training to backprop.
author | revcompgeek |
---|---|
date | Tue, 15 Apr 2008 14:39:49 -0600 |
parents | 314d68bafeff |
children |
line wrap: on
line source
module aid.misc; import std.random; import std.stdio; class InputException : Exception { this(char[] message){ super(message); } } double rnd(){ // The function that should be included in every math library! return (cast(double)rand())/uint.max; } void printArray(double[] array){ writef("["); for(int i=0; i<array.length-1; i++){ writef("%f, ",array[i]); } writefln("%f]",array[$-1]); } void printArray(double[][] array){ writef("["); for(int i=0; i<array.length; i++){ printArray(array[i]); } writefln("]"); } void printArray(double[][][] array){ writef("["); for(int i=0; i<array.length; i++){ printArray(array[i]); } writefln("]"); }