Module Expr Str ImportFrom alias Import alias identifier Import alias Import alias identifier ImportFrom alias Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias alias Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore NameLoad Assign NameStore Num Assign NameStore Call NameLoad keyword Str FunctionDef arguments args defaults body Expr Str Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword ListLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Num keyword ListLoad Str Str keyword ListLoad NameLoad Call NameLoad Num keyword ListLoad Call NameLoad Num Call NameLoad Num keyword ListLoad Call NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad Assign NameStore Lambda arguments args NameParam NameParam defaults BinOpDiv Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Call NameLoad ListLoad TupleLoad Num Num NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword Num Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad keyword Str keyword Num Expr Call AttributeLoad NameLoad attr Expr Call NameLoad Str decorator_list FunctionDef arguments args defaults body Expr Str With Call NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad AttributeLoad Call NameLoad keyword Str attr ExtSlice Slice Num Num Slice Assign NameStore Call AttributeLoad NameLoad attr ListLoad TupleLoad Num NameLoad keyword Num keyword NameLoad keyword NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword ListLoad Num Num keyword ListLoad Num Num keyword TupleLoad Num Num Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad AttributeLoad Call NameLoad keyword Str attr Num Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr keyword ListLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Num SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num keyword ListLoad Str Str NameLoad keyword BinOpMult ListLoad Call NameLoad Num Num keyword ListLoad Call NameLoad Num NameLoad Call NameLoad Num keyword ListLoad Call NameLoad NameLoad Call NameLoad keyword NameLoad Assign NameStore Call NameLoad Assign NameStore Lambda arguments args NameParam NameParam defaults BinOpDiv Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Call NameLoad Assign NameStore Lambda arguments args NameParam NameParam defaults BinOpDiv Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Call NameLoad ListLoad TupleLoad Num Num NameLoad TupleLoad Num Num NameLoad keyword NameLoad keyword Str Assign NameStore Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword Num Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad keyword Str keyword Num keyword ListLoad Call NameLoad Expr Call AttributeLoad NameLoad attr Expr Call NameLoad Str decorator_list FunctionDef arguments args defaults body Expr Str With Call NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad keyword Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr For NameStore Call NameLoad Num Num body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore BinOpDiv Call AttributeLoad Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad attr Num Expr Call NameLoad NameLoad NameLoad BinOpDiv NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad NameLoad body Expr Str With Call NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad keyword Str If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Num orelse Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad TupleLoad Num NameLoad keyword ListLoad Num Num keyword Num keyword NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword ListLoad Num Num keyword ListLoad Num Num keyword TupleLoad Num Num Expr Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str ImportFrom alias alias Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr TupleLoad Num Num Assign NameStore ListLoad Assign NameStore SubscriptLoad AttributeLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num attr Index Num For NameStore Call NameLoad NameLoad body Assign NameStore ListLoad Assign NameStore ListLoad For NameStore NameLoad body Assert CompareEq Call NameLoad NameLoad Num Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index NameLoad Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Num Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num If CompareEq SubscriptLoad NameLoad Index NameLoad Num body Assign NameStore Num orelse Assign NameStore BinOpDiv SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad Num Num Call NameLoad NameLoad Num Expr Call AttributeLoad NameLoad attr TupleLoad Num Num Call NameLoad NameLoad Call NameLoad BinOpMult Num NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad ExtSlice Slice Slice Index Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Num Num Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMult ListLoad Call AttributeLoad NameLoad attr TupleLoad Num Num Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call NameLoad Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr TupleLoad Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore BinOpMult ListLoad NameLoad Call NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareNotEq NameLoad Num body Assign SubscriptStore NameLoad Index NameLoad Str orelse Assign SubscriptStore NameLoad Index NameLoad Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return Call AttributeLoad Str attr NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad Expr Call NameLoad Expr Call NameLoad
N/A N/A 
.. todo::

    WRITEME
 __future__ print_function N/A cPickle pickle N/A itertools N/A numpy np theano.compat.six.moves xrange N/A theano.tensor T pylearn2.expr.activations rescaled_softmax pylearn2.costs.autoencoder MeanBinaryCrossEntropy pylearn2.costs.gsn GSNCost pylearn2.corruption BinomialSampler GaussianCorruptor MultinomialSampler SaltPepperCorruptor SmoothOneHotCorruptor pylearn2.datasets.mnist MNIST pylearn2.distributions.parzen ParzenWindows pylearn2.models.gsn GSN JointGSN pylearn2.termination_criteria EpochCounter pylearn2.train Train pylearn2.training_algorithms.sgd SGD MonitorBasedLRAdjuster pylearn2.utils image safe_zip N/A HIDDEN_SIZE 1000 N/A SALT_PEPPER_NOISE 0.4 N/A GAUSSIAN_NOISE 0.5 N/A WALKBACK 0 N/A LEARNING_RATE 0.25 N/A MOMENTUM 0.75 N/A MAX_EPOCHS 100 N/A BATCHES_PER_EPOCH None N/A BATCH_SIZE 100 N/A ds N/A MNIST which_set train test_train_ae N/A N/A N/A N/A N/A 
    .. todo::

        WRITEME
     N/A GC GaussianCorruptor N/A gsn N/A N/A GSN new layer_sizes N/A N/A N/A N/A ds X shape N/A 1 1000 activation_funcs N/A sigmoid tanh pre_corruptors N/A None N/A GC 1.0 post_corruptors N/A N/A SaltPepperCorruptor 0.5 N/A GC 1.0 layer_samplers N/A N/A BinomialSampler None tied False N/A _mbce N/A MeanBinaryCrossEntropy N/A reconstruction_cost N/A N/A N/A a b N/A N/A N/A N/A _mbce cost a b N/A N/A N/A ds X shape N/A 1 N/A c N/A GSNCost N/A N/A 0 1.0 reconstruction_cost walkback WALKBACK N/A alg N/A SGD LEARNING_RATE init_momentum MOMENTUM cost c termination_criterion N/A EpochCounter MAX_EPOCHS batches_per_iter BATCHES_PER_EPOCH batch_size BATCH_SIZE monitoring_dataset ds monitoring_batches 10 N/A trainer N/A Train ds gsn algorithm alg save_path gsn_ae_example.pkl save_freq 5 N/A N/A N/A trainer main_loop N/A N/A print done training N/A test_sample_ae N/A N/A N/A N/A N/A 
    Visualize some samples from the trained unsupervised GSN.
     N/A N/A open gsn_ae_example.pkl f N/A N/A gsn N/A N/A pickle load f N/A mb_data N/A N/A N/A MNIST which_set test X N/A N/A 105 106 N/A N/A history N/A N/A gsn get_samples N/A N/A 0 mb_data walkback 1000 symbolic False include_first True N/A history N/A list N/A N/A itertools chain history N/A history N/A N/A np vstack history N/A tiled N/A N/A image tile_raster_images history img_shape N/A 28 28 tile_shape N/A 50 50 tile_spacing N/A 2 2 N/A N/A N/A image save gsn_ae_example.png tiled N/A pw N/A ParzenWindows N/A N/A MNIST which_set test X 0.2 N/A N/A print N/A N/A pw get_ll history N/A test_train_supervised N/A N/A N/A N/A N/A 
    Train a supervised GSN.
     N/A gsn N/A N/A GSN new layer_sizes N/A N/A N/A N/A ds X shape N/A 1 1000 N/A N/A N/A ds y shape N/A 1 activation_funcs N/A sigmoid tanh rescaled_softmax pre_corruptors N/A N/A N/A GaussianCorruptor 0.5 3 post_corruptors N/A N/A SaltPepperCorruptor 0.3 None N/A SmoothOneHotCorruptor 0.5 layer_samplers N/A N/A BinomialSampler None N/A MultinomialSampler tied False N/A _rcost N/A MeanBinaryCrossEntropy N/A reconstruction_cost N/A N/A N/A a b N/A N/A N/A N/A _rcost cost a b N/A N/A N/A ds X shape N/A 1 N/A _ccost N/A MeanBinaryCrossEntropy N/A classification_cost N/A N/A N/A a b N/A N/A N/A N/A _ccost cost a b N/A N/A N/A ds y shape N/A 1 N/A c N/A GSNCost N/A N/A 0 1.0 reconstruction_cost N/A 2 2.0 classification_cost walkback WALKBACK mode supervised N/A alg N/A SGD LEARNING_RATE init_momentum MOMENTUM cost c termination_criterion N/A EpochCounter MAX_EPOCHS batches_per_iter BATCHES_PER_EPOCH batch_size BATCH_SIZE monitoring_dataset ds monitoring_batches 10 N/A trainer N/A Train ds gsn algorithm alg save_path gsn_sup_example.pkl save_freq 10 extensions N/A N/A MonitorBasedLRAdjuster N/A N/A N/A trainer main_loop N/A N/A print done training N/A test_classify N/A N/A N/A N/A N/A 
    See how well a (supervised) GSN performs at classification.
     N/A N/A open gsn_sup_example.pkl f N/A N/A gsn N/A N/A pickle load f N/A gsn N/A N/A JointGSN convert gsn N/A N/A gsn _corrupt_switch False N/A ds N/A MNIST which_set test N/A mb_data N/A ds X N/A y N/A ds y N/A i N/A xrange 1 10 N/A N/A y_hat N/A N/A gsn classify mb_data trials i N/A errors N/A N/A N/A N/A N/A np abs N/A y_hat y sum 2.0 N/A N/A print i errors N/A errors N/A N/A mb_data shape N/A 0 N/A test_sample_supervised N/A N/A idxs noisy N/A None True N/A N/A 
    Visualize samples and labels produced by GSN.
     N/A N/A open gsn_sup_example.pkl f N/A N/A gsn N/A N/A pickle load f N/A N/A gsn _corrupt_switch noisy N/A ds N/A MNIST which_set test N/A N/A idxs None N/A N/A data N/A N/A ds X N/A 100 150 N/A N/A data N/A N/A ds X N/A idxs N/A samples N/A N/A gsn get_samples N/A N/A 0 data indices N/A 0 2 walkback 21 symbolic False include_first True N/A stacked N/A vis_samples samples N/A tiled N/A N/A image tile_raster_images stacked img_shape N/A 28 28 tile_shape N/A 50 50 tile_spacing N/A 2 2 N/A N/A N/A image save gsn_sup_example.png tiled N/A vis_samples N/A N/A samples N/A N/A N/A 
    .. todo::

        WRITEME
     PIL ImageDraw ImageFont N/A img N/A N/A image pil_from_ndarray N/A N/A np zeros N/A 28 28 N/A chains N/A N/A num_rows N/A N/A N/A N/A samples N/A 0 N/A 0 shape N/A 0 N/A row N/A xrange num_rows N/A N/A images N/A N/A labels N/A N/A step samples N/A N/A N/A N/A len step 2 N/A N/A N/A images append N/A N/A step N/A 0 N/A row N/A vec N/A N/A step N/A 1 N/A row N/A sorted_idxs N/A N/A np argsort vec N/A label1 N/A sorted_idxs N/A -1 N/A label2 N/A sorted_idxs N/A -2 N/A N/A N/A vec N/A label1 0 N/A N/A ratio 1 N/A N/A ratio N/A N/A vec N/A label2 N/A vec N/A label1 N/A c N/A N/A img copy N/A draw N/A N/A ImageDraw Draw c N/A N/A N/A draw text N/A 8 11 N/A str label1 255 N/A N/A N/A draw text N/A 14 11 N/A str label2 N/A int N/A 255 ratio N/A nd N/A N/A N/A image ndarray_from_pil c N/A N/A N/A N/A 0 N/A nd N/A N/A nd reshape N/A 1 784 N/A N/A N/A labels append nd N/A data N/A safe_zip images labels N/A data N/A list N/A N/A itertools chain data N/A N/A N/A data extend N/A N/A N/A N/A np ones N/A 1 784 2 N/A N/A N/A chains append N/A N/A np vstack data N/A N/A N/A np vstack chains N/A print_char N/A N/A A N/A N/A N/A 
    .. todo::

        WRITEME
     N/A N/A print N/A a_to_s N/A N/A N/A N/A A round reshape N/A 28 28 N/A a_to_s N/A N/A A N/A N/A N/A Prints binary array N/A strs N/A N/A row A N/A N/A x N/A N/A None N/A len row N/A N/A i num N/A enumerate row N/A N/A N/A num 0 N/A N/A N/A x N/A i @ N/A N/A N/A x N/A i N/A N/A N/A strs append N/A N/A join x N/A N/A N/A join strs N/A N/A N/A __name__ __main__ N/A N/A N/A test_train_supervised N/A N/A test_classify N/A N/A test_sample_supervised