sigmoidactivationfunction.cs

来自「AI : Neural Network for beginners」· CS 代码 · 共 26 行

CS
26
字号
using System;
using System.Collections.Generic;
using System.Text;

namespace GA_ANN_XOR
{
    #region SigmoidActivationFunction CLASS
    /// <summary>
    /// Provides a sigmoid activation function
    /// </summary>
    public class SigmoidActivationFunction
    {
        /// <summary>
        /// Takes a value for a current network node, and applies a sigmoid
        /// activation function to it, which is then returned
        /// </summary>
        /// <param name="x">The value to apply the activation to</param>
        /// <returns>The activation value, after a sigmoid function</returns>
        public static double processValue(double x)
        {
            return 1.0 / (1.0 + Math.Pow(Math.E, -x));
        }
    }
    #endregion
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?