Exemplo n.º 1
0
def test0():
    try:
        client = Client(debug=True)
    except IOError:
        raise SkipTest()

    client[:].use_cloudpickle()
    trials = IPythonTrials(client, 'log')

    def simple_objective(args):
        # -- why are these imports here !?
        # -- is it because they need to be imported on the client?
        #
        # Yes, the client namespace is empty, so some imports may be
        # needed here. Errors on the engines can be found by
        # using debug=True when instantiating the Client.
        import hyperopt
        return {'loss': args**2, 'status': hyperopt.STATUS_OK}

    space = hyperopt.hp.uniform('x', 0, 1)

    minval = trials.fmin(simple_objective,
                         space=space,
                         algo=hyperopt.tpe.suggest,
                         max_evals=25,
                         verbose=True)
    print(minval)
    assert minval['x'] < .2
Exemplo n.º 2
0
def test0():
    client = Client()
    trials = IPythonTrials(client)

    minval = trials.fmin(simple_objective, space, hyperopt.tpe.suggest, 25)
    print minval
    assert minval['x'] < .2
Exemplo n.º 3
0
def test0():
    client = Client()
    trials = IPythonTrials(client)

    minval = trials.fmin(simple_objective, space, hyperopt.tpe.suggest, 25)
    print minval
    assert minval['x'] < .2
Exemplo n.º 4
0
def test0():
    try:
        client = Client(debug=True)
    except IOError:
        raise SkipTest()

    client[:].use_dill()
    trials = IPythonTrials(client, 'log')

    def simple_objective(args):
        # -- why are these imports here !?
        # -- is it because they need to be imported on the client?
        #
        # Yes, the client namespace is empty, so some imports may be
        # needed here. Errors on the engines can be found by
        # using debug=True when instantiating the Client.
        import hyperopt
        return {'loss': args ** 2, 'status': hyperopt.STATUS_OK}

    space = hyperopt.hp.uniform('x', 0, 1)

    minval = trials.fmin(simple_objective, space=space,
                         algo=hyperopt.tpe.suggest, max_evals=25, verbose=True)
    print(minval)
    assert minval['x'] < .2
def test0():
    try:
        client = Client()
    except IOError:
        raise SkipTest()
    trials = IPythonTrials(client)

    minval = trials.fmin(simple_objective, space, hyperopt.tpe.suggest, 25)
    print minval
    assert minval['x'] < .2