def test_classify():
    """
    See how well a (supervised) GSN performs at classification.
    """
    with open("gsn_sup_example.pkl") as f:
        gsn = pickle.load(f)

    gsn = JointGSN.convert(gsn)

    # turn off corruption
    gsn._corrupt_switch = False

    ds = MNIST(which_set='test')
    mb_data = ds.X
    y = ds.y

    for i in xrange(1, 10):
        y_hat = gsn.classify(mb_data, trials=i)
        errors = np.abs(y_hat - y).sum() / 2.0

        # error indices
        #np.sum(np.abs(y_hat - y), axis=1) != 0

        print(i, errors, errors % mb_data.shape[0])
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/gsn_example.py/test_classify/operator `/` -> `%`