コード例 #1
0
import numpy as np
from thor_client import ThorClient
from franke import franke


# Create experiment.
tc = ThorClient()
name = "Franke Function"
# Create space.
dims = [
    {"name": "x", "dim_type": "linear", "low": 0., "high": 1.},
    {"name": "y", "dim_type": "linear", "low": 0., "high": 1.}
]
exp = tc.create_experiment(name, dims)

# Main optimization loop.
for i in range(30):
    # Request new recommendation.
    rec = exp.create_recommendation()
    x = rec.config
    # Evaluate new recommendation.
    val = franke(np.array([x["x"], x["y"]]))
    # Submit recommendation.
    rec.submit_recommendation(val)
コード例 #2
0
ファイル: main.py プロジェクト: afcarl/Thor-Python-Client
    {
        "name": "C",
        "dim_type": "integer",
        "low": 0,
        "high": 24
    },
    {
        "name": "alpha",
        "dim_type": "integer",
        "low": 0,
        "high": 13
    },
    {
        "name": "epsilon",
        "dim_type": "integer",
        "low": 0,
        "high": 3
    },
]
exp = tc.create_experiment(name, dims, overwrite=True)

# Main optimization loop.
for i in range(100):
    # Request new recommendation.
    rec = exp.create_recommendation()
    x = rec.config
    # Evaluate new recommendation.
    val = -svm_on_grid(x["C"], x["alpha"], x["epsilon"])
    # Submit recommendation.
    rec.submit_recommendation(val)
コード例 #3
0
ファイル: main.py プロジェクト: afcarl/Thor-Python-Client
            batch_xs, batch_ys = mnist.train.next_batch(n_batch)
            sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})
        # At the end of the learning sequence, return the accuracy on the test
        # set of images.
        return sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels})


# Create experiment.
tc = ThorClient()
dims = [
    {"name": "learning rate", "dim_type": "logarithmic", "low": 1e-8, "high": 1.},
    {"name": "regularizer", "dim_type": "linear", "low": 0., "high": 1.},
    {"name": "batch size", "dim_type": "integer", "low": 20, "high": 2000},
    {"name": "epochs", "dim_type": "integer", "low": 5, "high": 20000}
]
exp = tc.create_experiment("MNIST Logistic Regression", dims, overwrite=True)

# Main optimization loop.
for i in range(100):
    # Request new recommendation.
    rec = exp.create_recommendation()
    c = rec.config
    # Evaluate new recommendation.
    val = mnist_logistic(
        c["learning rate"], c["regularizer"], c["batch size"], c["epochs"]
    )
    # Submit recommendation.
    rec.submit_recommendation(val)