Class BlackBoxGradient

  • All Implemented Interfaces:
    IGradientFunction

    public class BlackBoxGradient
    extends java.lang.Object
    implements IGradientFunction
    Difference quotient based gradient estimation. This class will give a black-box gradient estimation by simply calculating (f(x + h) - f(x))/h where x is the provided point and x' is a point that slightly differs, specified by the parameter precision. (Obviously it holds that in lim_{precision -> 0} this yields the exact gradient.) If x is a vector (a_o, ..., a_n), then, instead we calculate each partial derivative i by: (f(a_o, ... a_i +h, ... , a_n) - f((a_o, ..., a_n)))/h Obviously, this is a highly inefficient approach for estimating the gradient (if we have n partial derivatives, we need 2 *n estimations).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.api4.java.common.math.IVector apply​(org.api4.java.common.math.IVector xVec)
      Returns the result of applying the gradient to the point represented by the given vector.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BlackBoxGradient

        public BlackBoxGradient​(IGradientDescendableFunction underlyingFunction,
                                double precision)
        Sets up a gradient-estimator for the given function. The estimation of the gradient can be tuned by the precision parameter.
        Parameters:
        underlyingFunction - the function for which the gradient shall be estimated
        precision - the precision of the estimation, the close this value is to zero the better is the estimation
    • Method Detail

      • apply

        public org.api4.java.common.math.IVector apply​(org.api4.java.common.math.IVector xVec)
        Description copied from interface: IGradientFunction
        Returns the result of applying the gradient to the point represented by the given vector.
        Specified by:
        apply in interface IGradientFunction
        Parameters:
        xVec - the vector the gradient is applied to
        Returns:
        the new vector resulting from applying the gradient to the given vector