Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(1)  |  Import(1)

src/s/c/scipy-0.13.3/scipy/optimize/tests/test__basinhopping.py   scipy(Download)
from scipy.optimize import basinhopping, minimize
from scipy.optimize._basinhopping import Storage, RandomDisplacement, \
    Metropolis, AdaptiveStepsize
class MyTakeStep1(RandomDisplacement):
    """use a copy of displace, but have it set a special parameter to
    make sure it's actually being used."""
    def __init__(self):
        self.been_called = False
    def setUp(self):
        self.stepsize = 1.0
        self.displace = RandomDisplacement(stepsize=self.stepsize)
        self.N = 300000
        self.x0 = np.zeros([self.N])
    def setUp(self):
        self.stepsize = 1.
        self.ts = RandomDisplacement(stepsize=self.stepsize)
        self.target_accept_rate = 0.5
        self.takestep = AdaptiveStepsize(takestep=self.ts, verbose=False,