{"action":"closed","issue":{"url":"https://api.github.com/repos/lmjohns3/theanets/issues/102","labels_url":"https://api.github.com/repos/lmjohns3/theanets/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/lmjohns3/theanets/issues/102/comments","events_url":"https://api.github.com/repos/lmjohns3/theanets/issues/102/events","html_url":"https://github.com/lmjohns3/theanets/issues/102","id":111684452,"number":102,"title":"Problem with reproducibility for release 0.6.2","user":{"login":"tata-antares","id":7202615,"avatar_url":"https://avatars.githubusercontent.com/u/7202615?v=3","gravatar_id":"","url":"https://api.github.com/users/tata-antares","html_url":"https://github.com/tata-antares","followers_url":"https://api.github.com/users/tata-antares/followers","following_url":"https://api.github.com/users/tata-antares/following{/other_user}","gists_url":"https://api.github.com/users/tata-antares/gists{/gist_id}","starred_url":"https://api.github.com/users/tata-antares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tata-antares/subscriptions","organizations_url":"https://api.github.com/users/tata-antares/orgs","repos_url":"https://api.github.com/users/tata-antares/repos","events_url":"https://api.github.com/users/tata-antares/events{/privacy}","received_events_url":"https://api.github.com/users/tata-antares/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-15T18:57:35Z","updated_at":"2015-12-01T22:18:28Z","closed_at":"2015-12-01T22:18:28Z","body":"Hi!\r\n\r\nThis code prints different values for different runs. Maybe, I missed some parameter in algo to fix random state, but also random.seed can't help fix reproducibility.  \r\n\r\n```python\r\nfrom __future__ import division, print_function, absolute_import\r\n\r\nimport numpy as np\r\nimport theanets\r\n\r\nclass Base(object):\r\n    def __init__(self):\r\n        self.NUM_EXAMPLES = 64\r\n        self.NUM_INPUTS = 7\r\n        self.NUM_OUTPUTS = 3\r\n        self.NUM_CLASSES = 5\r\n\r\n        np.random.seed(41)\r\n\r\n        self.INPUTS = np.random.randn(self.NUM_EXAMPLES, self.NUM_INPUTS).astype('f')\r\n        self.INPUT_WEIGHTS = abs(np.random.randn(self.NUM_EXAMPLES, self.NUM_INPUTS)).astype('f')\r\n        self.OUTPUTS = np.random.randn(self.NUM_EXAMPLES, self.NUM_OUTPUTS).astype('f')\r\n        self.OUTPUT_WEIGHTS = abs(np.random.randn(self.NUM_EXAMPLES, self.NUM_OUTPUTS)).astype('f')\r\n        self.CLASSES = np.random.randn(self.NUM_EXAMPLES).astype('i')\r\n        self.CLASS_WEIGHTS = abs(np.random.rand(self.NUM_EXAMPLES)).astype('f')\r\n\r\n    def assert_progress(self, algo, data, **kwargs):\r\n        trainer = self.exp.itertrain(\r\n            data, algorithm=algo, monitor_gradients=True, batch_size=3, rng=11, nrng=13, **kwargs)\r\n        train0, valid0 = next(trainer)\r\n        train1, valid1 = next(trainer)\r\n        assert train1['loss'] < valid0['loss']   # should have made progress!\r\n        assert valid1['loss'] == valid0['loss']  # no new validation occurred\r\n        return [train1['loss'], train0['loss'], valid1['loss'], valid0['loss']]\r\n\r\n\r\nclass TestClassifier(Base):\r\n    def test_sgd(self):\r\n        np.random.seed(41)\r\n\r\n        self.exp = theanets.Experiment(\r\n            theanets.Classifier,\r\n            layers=(self.NUM_INPUTS, 10, self.NUM_CLASSES))\r\n        print(self.assert_progress('sgd', [self.INPUTS, self.CLASSES]))\r\n```"}}