def test_sample_supervised(idxs=None, noisy=True):
 with open('gsn_sup_example.pkl') as f:
  gsn = pickle.load(f)
 gsn._corrupt_switch = noisy
 ds = MNIST(which_set='test')
 if (idxs is None):
  data = ds.X[100:150]
 else:
  data = ds.X[idxs]
 samples = gsn.get_samples([(0, data)], indices=[0, 2], walkback=21, symbolic=False, include_first=True)
 stacked = vis_samples(samples)
 tiled = image.tile_raster_images(stacked, img_shape=[28, 28], tile_shape=[50, 50], tile_spacing=(2, 2))
 image.save('gsn_sup_example.png', tiled)

def test_sample_supervised ( idxs = None , noisy = True ) : with open ( 'gsn_sup_example.pkl' ) as f : gsn = pickle . load ( f ) gsn . _corrupt_switch = noisy ds = MNIST ( which_set = 'test' ) if ( idxs is None ) : data = ds . X [ 100 : 150 ] else : data = ds . X [ idxs ] samples = gsn . get_samples ( [ ( 0 , data ) ] , indices = [ 0 , 2 ] , walkback = 21 , symbolic = False , include_first = True ) stacked = vis_samples ( samples ) tiled = image . tile_raster_images ( stacked , img_shape = [ 28 , 28 ] , tile_shape = [ 50 , 50 ] , tile_spacing = ( 2 , 2 ) ) image . save ( 'gsn_sup_example.png' , tiled )
visualize samples and labels produced by gsn .