Mercurial > projects > aid
diff 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 diff
--- a/trunk/aid/misc.d Sat Apr 12 21:55:37 2008 -0600 +++ b/trunk/aid/misc.d Tue Apr 15 14:39:49 2008 -0600 @@ -1,6 +1,7 @@ module aid.misc; import std.random; +import std.stdio; class InputException : Exception { this(char[] message){ @@ -10,4 +11,28 @@ 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("]"); } \ No newline at end of file