|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ANN.Perceptron.ActivationFunction
{
using System;
/// <summary>
/// Sigmoid activation function
/// </summary>
///
/// <remarks>The class represents sigmoid activation function with
/// the next expression:<br />
/// <code>
/// 1
/// f(x) = ------------------
/// 1 + exp(-alpha * x)
///
/// alpha * exp(-alpha * x )
/// f'(x) = ---------------------------- = alpha * f(x) * (1 - f(x))
/// (1 + exp(-alpha * x))^2
/// </code>
/// Output range of the function: <b>[0, 1]</b><br /><br />
/// Functions graph:<br />
/// <img src="sigmoid.bmp" width="242" height="172" />
/// </remarks>
///
public class SigmoidFunction : IActivationFunction
{
/// <summary>
/// //Sigmoid function
/// </summary>
/// <param name="x"></param>
/// <returns></returns>
public static double SIGMOID(double x)
{
return (1.7159 * System.Math.Tanh(0.66666667 * x));
}
/// <summary>
/// // // derivative of the sigmoid as a function of the sigmoid's output
/// </summary>
/// <param name="S"></param>
/// <returns></returns>
public static double DSIGMOID(double S)
{
return (0.66666667 / 1.7159 * (1.7159 + (S)) * (1.7159 - (S)));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.