view 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
line wrap: on
line source

module aid.nn.outputFunctions;

import aid.nn.outputFunctions;
import std.math;

alias double function(double) OutputFunctionPtr;

enum OutputFunction {
	Linear=0, Sign, Sigmoid, Tanh
}

double sign(double y){
	if(y>0) return 1;
	return -1;
}

double sigmoid(double x){
	return 1/(1+exp(-x));
}

double tanh(double x){
	return cast(double)tanh(cast(real)x);
}