src/ExpertSystems/ANFIS/membership/BellShapedRule.cs
/// <summary>
/// Gradient for memb. function parameters
/// </summary>
/// <param name="point"></param>
/// <returns></returns>
Gradient for memb. function parameters
Gradient for memb . function parameters
public double[] GetGradient(double[] point)
        {
            double[] grad = new double[xdim + 2];
            double sum = 0.0;
            for (int i = 0; i < xdim; i++)
                sum += pow2(point[i] - parameters[i]);
            sum /= pow2(a);
            double tmp = sum;
            sum = Math.Pow(sum, b);
            for (int i = 0; i < xdim; i++)
                grad[i] = 2.0 * sum * b * (point[i] - parameters[i]) / (pow2(1 + sum) * tmp * pow2(a));
            grad[xdim] = 2.0 * sum * b / (pow2(1 + sum) * a);
            grad[xdim + 1] = -sum * Math.Log(tmp) / pow2(1 + sum);
            return grad;
        }
public double [ ] GetGradient ( double [ ] point ) { double [ ] grad = new double [ xdim + 2 ] ; double sum = 0.0 ; for ( int i = 0 ; i < xdim ; i ++ ) sum += pow2 ( point [ i ] - parameters [ i ] ) ; sum /= pow2 ( a ) ; double tmp = sum ; sum = Math . Pow ( sum , b ) ; for ( int i = 0 ; i < xdim ; i ++ ) grad [ i ] = 2.0 * sum * b * ( point [ i ] - parameters [ i ] ) / ( pow2 ( 1 + sum ) * tmp * pow2 ( a ) ) ; grad [ xdim ] = 2.0 * sum * b / ( pow2 ( 1 + sum ) * a ) ; grad [ xdim + 1 ] = - sum * Math . Log ( tmp ) / pow2 ( 1 + sum ) ; return grad ; }
Gradient for memb.
Gradient for memb .
None
point
double[]
None