<commit_before>import theanets

import util


class TestTrainer(util.MNIST):
    def setUp(self):
        super(TestTrainer, self).setUp()
        self.exp = theanets.Experiment(
            theanets.Autoencoder,
            layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE))

    def assert_progress(self, algo, **kwargs):
        trainer = self.exp.itertrain(self.images, optimize=algo, **kwargs)
        costs0 = next(trainer)
        costs1 = next(trainer)
        costs2 = next(trainer)
        assert costs2['loss'] < costs0['loss']

    def test_sgd(self):
        self.assert_progress('sgd', learning_rate=1e-4)

    def test_nag(self):
        self.assert_progress('nag', learning_rate=1e-4)

    def test_rprop(self):
        self.assert_progress('rprop', learning_rate=1e-4)

    def test_rmsprop(self):<commit_msg>Update test to work with new monitors.<commit_after>import theanets

import util


class TestTrainer(util.MNIST):
    def setUp(self):
        super(TestTrainer, self).setUp()
        self.exp = theanets.Experiment(
            theanets.Autoencoder,
            layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE))

    def assert_progress(self, algo, **kwargs):
        trainer = self.exp.itertrain(self.images, optimize=algo, **kwargs)
        t0, v0 = next(trainer)
        t1, v1 = next(trainer)
        t2, v2 = next(trainer)
        assert t2['loss'] < t0['loss']

    def test_sgd(self):
        self.assert_progress('sgd', learning_rate=1e-4)

    def test_nag(self):
        self.assert_progress('nag', learning_rate=1e-4)

    def test_rprop(self):
        self.assert_progress('rprop', learning_rate=1e-4)

    def test_rmsprop(self):
{'fraction_non_alphanumeric': 0.12522576760987358, 'fraction_numerical': 0.017459361830222758, 'mean_word_length': 2.9665871121718377, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5070672', 'n_tokens_mistral': 587, 'n_tokens_neox': 568, 'n_words': 102}