예제 #1
0
        /// <summary>
        ///   Polynomial kernel function.
        /// </summary>
        ///
        /// <param name="x">Vector <c>x</c> in input space.</param>
        /// <param name="y">Vector <c>y</c> in input space.</param>
        /// <returns>Dot product in feature (kernel) space.</returns>
        ///
        public override double Function(double[] x, double[] y)
        {
            double sum = SparseLinear.Product(x, y) + constant;

            return(Math.Pow(sum, Degree));
        }
예제 #2
0
        /// <summary>
        ///   Sigmoid kernel function.
        /// </summary>
        ///
        /// <param name="x">Vector <c>x</c> in input space.</param>
        /// <param name="y">Vector <c>y</c> in input space.</param>
        /// <returns>Dot product in feature (kernel) space.</returns>
        ///
        public override double Function(double[] x, double[] y)
        {
            double sum = SparseLinear.Product(x, y);

            return(System.Math.Tanh(Gamma * sum + Constant));
        }