def test_sample_ae():
    with open("gsn_ae_example.pkl") as f:
        gsn = pickle.load(f)

    # random point to start at
    mb_data = MNIST(which_set='test').X[105:106, :]

    history = gsn.get_samples([(0, mb_data)], walkback=1000,
                              symbolic=False, include_first=True)

    history = list(itertools.chain(*history))
    history = np.vstack(history)

    tiled = image.tile_raster_images(history,
                                     img_shape=[28,28],
                                     tile_shape=[50,50],
                                     tile_spacing=(2,2))
    image.save("gsn_ae_example.png", tiled)

    # code to get log likelihood from kernel density estimator
    # this crashed on GPU (out of memory), but works on CPU
    pw = ParzenWindows(MNIST(which_set='test').X, .20)
    print(pw.get_ll(history))
Visualize some samples from the trained unsupervised GSN.
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/gsn_example.py/test_sample_ae