def test_reject_mon_batch_without_mon():

    # tests that setting up the sgd algorithm
    # without a monitoring dataset
    # but with monitoring_batches specified is an error

    dim = 3
    m = 10

    rng = np.random.RandomState([25, 9, 2012])

    X = rng.randn(m, dim)

    idx = rng.randint(0, dim, (m,))
    Y = np.zeros((m, dim))
    for i in xrange(m):
        Y[i, idx[i]] = 1

    dataset = DenseDesignMatrix(X=X, y=Y)

    m = 15
    X = rng.randn(m, dim)

    idx = rng.randint(0, dim, (m, ))
    Y = np.zeros((m, dim))
    for i in xrange(m):
        Y[i, idx[i]] = 1

    model = SoftmaxModel(dim)

    learning_rate = 1e-3
    batch_size = 5

    cost = SupervisedDummyCost()

    try:
        algorithm = SGD(learning_rate,
                        cost,
                        batch_size=batch_size,
                        monitoring_batches=3,
                        monitoring_dataset=None,
                        update_callbacks=None,
                        set_batch_size=False)
    except __HOLE__:
        return

    assert False
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/training_algorithms/tests/test_sgd.py/test_reject_mon_batch_without_mon