

def test_golden_search_function(self):

    def f(x):
        return (T.sin(x) * (x ** (- 0.5)))

    def check_updates(step):
        return f((3 + step))
    best_step = fmin_golden_search(check_updates)
    self.assertAlmostEqual(1.6, best_step.eval(), places=2)
    best_step = fmin_golden_search(check_updates, maxstep=1)
    self.assertAlmostEqual(1, best_step.eval(), places=2)

dataset/ETHPy150Open itdxer/neupy/tests/optimizations/test_golden_search.py GoldenSearchTestCase.test_golden_search_function/original