// $Id$ // // File: nnann_function_sigmoid.h // Created: Tue Mar 22 23:21:37 EDT 2011 // Creator: davidl (on Darwin Amelia.local 9.8.0 i386) // #ifndef _nnann_function_sigmoid_ #define _nnann_function_sigmoid_ #include #include class nnann_function_sigmoid:public nnann_function{ public: nnann_function_sigmoid(double k=1.0){this->k = k;} virtual ~nnann_function_sigmoid(){}; void SetK(double k){this->k = k;} double GetK(void){return k;} std::string GetName(void){return "Sigmoid";} virtual double f(double x){ return 1.0/(1.0 + std::exp(-k*x)); // standard sigmoid function } virtual double dfdx(double x){ double my_f = f(x); return my_f*(1.0-my_f); // derivative of sigmoid } protected: double k; }; #endif // _nnann_function_sigmoid_