Ejemplo n.º 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)
Ejemplo n.º 2
0
from thor_client import ThorClient
from svm_on_grid import svm_on_grid

# Create experiment.
tc = ThorClient()
name = "Structured SVM"
# Create space.
dims = [
    {
        "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):
Ejemplo n.º 3
0
    with tf.Session() as sess:
        # Initialize TensorFlow.
        sess.run(tf.global_variables_initializer())
        # Perform learning iterations.
        for _ in range(n_iters):
            if _ % n_prog == 0:
                print("Progress: {} / {}.".format(_ + 1, n_iters))
            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(