comparison trunk/aid/nn/outputFunctions.d @ 3:314d68bafeff

Backprop and backprop_test added (no testing).
author revcompgeek
date Fri, 11 Apr 2008 18:12:55 -0600
parents
children ff92c77006c7
comparison
equal deleted inserted replaced
2:9655c8362b25 3:314d68bafeff
1 module aid.nn.outputFunctions;
2
3 import aid.nn.outputFunctions;
4 import std.math;
5
6 alias double function(double) OutputFunctionPtr;
7
8 enum OutputFunction {
9 Linear=0, Sign, Sigmoid, Tanh
10 }
11
12 double sign(double y){
13 if(y>0) return 1;
14 return -1;
15 }
16
17 double sigmoid(double x){
18 return 1/(1+exp(-x));
19 }
20
21 double tanh(double x){
22 return cast(double)tanh(cast(real)x);
23 }