def test_problems():
    """Test problems for visualizations."""
    # Unlike the training problem sets, these test problems are made up of
    # length-5 tuples. The final items in the tuple are the name of the problem
    # and the initialization random_seed for testing consistency.
    tp = [
        (_Spec(pg.Quadratic, (20, ),
               {"random_seed": 1234}), None, None, "quad_problem", 5678),
        (_Spec(pg.Quadratic, (20, ), {
            "noise_stdev": 1.0,
            "random_seed": 1234
        }), None, None, "quad_problem_noise", 5678),
        (_Spec(pg.Rosenbrock, (),
               {"random_seed": 1234}), None, None, "rosenbrock", 5678),
        (_Spec(pg.Rosenbrock, (), {
            "random_seed": 1234,
            "noise_stdev": 1.0
        }), None, None, "rosenbrock_noise", 5678),
        (_Spec(pg.SoftmaxRegression, (10, 2),
               {}), datasets.random(10, 10000,
                                    random_seed=1234), 100, "softmax", 5678),
        (_Spec(pg.SoftmaxRegression, (10, 2), {"noise_stdev": 1.0}),
         datasets.random(10, 10000,
                         random_seed=1234), 100, "softmax_noise", 5678),
        (_Spec(pg.FullyConnected, (10, 2),
               {}), datasets.random(10, 10000,
                                    random_seed=1234), 100, "mlp_small",
         _test_problem_mlp_scaled_init_small()),
        (_Spec(pg.FullyConnected, (20, 10),
               {}), datasets.random(20, 10000, n_classes=10,
                                    random_seed=1234), 100, "mlp_large",
         _test_problem_mlp_scaled_init_large()),
        (_Spec(pg.FullyConnected, (784, 10), {
            "hidden_sizes": (64, ),
            "activation": tf.nn.sigmoid
        }), datasets.mnist(), 64, "mlp_mnist_sigmoid",
         _test_problem_mlp_scaled_init_mnist()),
        (_Spec(pg.FullyConnected, (784, 10), {
            "hidden_sizes": (64, ),
            "activation": tf.nn.relu
        }), datasets.mnist(), 64, "mlp_mnist_relu",
         _test_problem_mlp_scaled_init_mnist()),
        (_Spec(pg.ConvNet, ((1, 28, 28), 10, [(3, 3, 8), (5, 5, 8)]),
               {"activation": tf.nn.sigmoid}), datasets.mnist(), 64,
         "convnet_mnist_sigmoid", None),
        (_Spec(pg.ConvNet, ((1, 28, 28), 10, [(3, 3, 8), (5, 5, 8)]),
               {"activation": tf.nn.relu}), datasets.mnist(), 64,
         "convnet_mnist_relu", None),
    ]
    return tp
Exemplo n.º 2
0
def mnist_conv_problems():
    return [
        # (_Spec(pg.ConvNet, ((1, 28, 28), 10, [(3, 3, 8), (5, 5, 8)]),
        #        {"activation": tf.nn.sigmoid}), datasets.mnist(train=True), 64),
        (_Spec(pg.ConvNet, ((1, 28, 28), 10, [(3, 3, 8), (5, 5, 8)]),
               {"activation": tf.nn.relu}), datasets.mnist(train=True), 64)
    ]
def test_mnist_conv_orig_problems():
    return [(_Spec(pg.ConvNetOrig, ((1, 28, 28), 10, [(3, 3, 8), (5, 5, 8)]),
                   {"activation": tf.nn.relu}), datasets.mnist(train=False),
             64)]
def test_mnist_conv_problems():
    return [(_Spec(pg.ConvNet,
                   ((1, 28, 28), 10, [(3, 3, 16, 1), (5, 5, 32, 1)]), {
                       "activation": tf.nn.relu,
                       "affine_size": 512
                   }), datasets.mnist(train=False), 128)]
def test_mnist_mlp_deeper_problems():
    tp = [(_Spec(pg.FullyConnected, (784, 10), {
        "hidden_sizes": (20, 20),
        "activation": tf.nn.sigmoid
    }), datasets.mnist(train=False), 128)]
    return tp