<NME> test_gsn.py
<BEF> """
No tests for now, but there is an example of use in
pylearn2/scripts/gsn_example.py
"""
T = theano.tensor
F = theano.function

from pylearn2.costs.gsn import MBWalkbackCrossEntropy as Cost
from pylearn2.corruption import GaussianCorruptor, SaltPepperCorruptor
from pylearn2.datasets.mnist import MNIST
from pylearn2.models.gsn import GSN
pre_corruptor = GaussianCorruptor(GAUSSIAN_NOISE)
post_corruptor = GaussianCorruptor(GAUSSIAN_NOISE)

gsn = GSN.new(layers, vis_corruptor, pre_corruptor, post_corruptor)

def test_train():
    alg = SGD(LEARNING_RATE, init_momentum=MOMENTUM, cost=Cost(walkback=WALKBACK),
              termination_criterion=EpochCounter(MAX_EPOCHS),
              batches_per_iter=BATCHES_PER_EPOCH, batch_size=BATCH_SIZE
              ,monitoring_dataset={"test": MNIST(which_set='test')}

<MSG> fixed more bugs

<DFF> @@ -5,7 +5,8 @@ import theano
 T = theano.tensor
 F = theano.function
 
-from pylearn2.costs.gsn import MBWalkbackCrossEntropy as Cost
+from pylearn2.costs.autoencoder import MeanBinaryCrossEntropy
+from pylearn2.costs.gsn import GSNCost
 from pylearn2.corruption import GaussianCorruptor, SaltPepperCorruptor
 from pylearn2.datasets.mnist import MNIST
 from pylearn2.models.gsn import GSN
@@ -35,10 +36,11 @@ vis_corruptor = SaltPepperCorruptor(SALT_PEPPER_NOISE)
 pre_corruptor = GaussianCorruptor(GAUSSIAN_NOISE)
 post_corruptor = GaussianCorruptor(GAUSSIAN_NOISE)
 
-gsn = GSN.new(layers, vis_corruptor, pre_corruptor, post_corruptor)
+gsn = GSN.new_ae(layers, vis_corruptor, pre_corruptor, post_corruptor)
 
 def test_train():
-    alg = SGD(LEARNING_RATE, init_momentum=MOMENTUM, cost=Cost(walkback=WALKBACK),
+    c = GSNCost([(0, 1.0, MeanBinaryCrossEntropy)], walkback=WALKBACK)
+    alg = SGD(LEARNING_RATE, init_momentum=MOMENTUM, cost=c,
               termination_criterion=EpochCounter(MAX_EPOCHS),
               batches_per_iter=BATCHES_PER_EPOCH, batch_size=BATCH_SIZE
               ,monitoring_dataset={"test": MNIST(which_set='test')}

{'addition_count': 5, 'commit_subject': 'fixed more bugs', 'deletion_count': 3, 'file_extension': '.py', 'lang': 'py', 'license': 'bsd-3-clause', 'repo_name': 'lisa-lab/pylearn2'}