From 898adda122c394e891b6fec91e6a0e8b688af47d Mon Sep 17 00:00:00 2001 From: swaits Date: Wed, 18 Apr 2007 00:26:21 +0000 Subject: [PATCH] added another activation function, plus minor cleanup --- polyapprox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/polyapprox.cpp b/polyapprox.cpp index 418e756..42cacdc 100644 --- a/polyapprox.cpp +++ b/polyapprox.cpp @@ -15,7 +15,8 @@ double TargetFunction(double x) //return exp(-x*x); // gaussian //return tanh(x); // tanh //return (2.0/(1.0+exp(-x))-1.0); // tanh approximation - return (x<0.0 ? -1.0 : 1.0) * sqrt(abs(x)); // signed root + //return (x<0.0 ? -1.0 : 1.0) * sqrt(abs(x)); // signed root + return sin(x); // sin } @@ -51,7 +52,8 @@ class PolySearch: public DE::Engine double actual = TargetFunction(i); // accumulate error^2 - error += (test-actual)*(test-actual); + double e = test - actual; + error += e * e; // inc test count (divisor to get from SE to MSE) test_count++;