Example #1
0
    def derivative(self, input_vec, output_vec):
        """Return the derivative of this function.

        We take both input and output vector because
        some derivatives can be more efficiently calculated from
        the output of this function.
        """
        return calculate.dgaussian(input_vec, output_vec, self._variance)
def test_dgaussian_matrix():
    tensor_shape = [random.randint(1, 10) for _ in range(2)]

    helpers.check_gradient(
        lambda X: calculate.gaussian(X),
        lambda X: calculate.dgaussian(X, calculate.gaussian(X)),
        f_arg_tensor=numpy.random.random(tensor_shape),
        f_shape='lin')
Example #3
0
def test_dgaussian():
    helpers.check_gradient(
        calculate.gaussian,
        lambda x: calculate.dgaussian(x, calculate.gaussian(x)),
        f_shape='lin')