view trunk/aid/nn/outputFunctions.d @ 6:ff92c77006c7

Added support for reading training examples from files.
author revcompgeek
date Tue, 06 May 2008 21:43:55 -0600
parents 314d68bafeff
children
line wrap: on
line source

/**
 * outputFunctions.d
 * Holds all of the output functions used by the neural networks.
 */

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);
}