class TestMomentumSGD(TestCase): def setUp(self): self.optimizer = MomentumSGD(0.1) self.model = LinearModel(self.optimizer) def test_linear_model_cpu(self): self.assertGreater(self.model.accuracy(False), 0.8) @attr.gpu def test_linear_model_gpu(self): self.assertGreater(self.model.accuracy(True), 0.8)
class TestAdaDelta(TestCase): def setUp(self): self.optimizer = AdaDelta(eps=1e-5) self.model = LinearModel(self.optimizer) def test_linear_model_cpu(self): self.assertGreater(self.model.accuracy(False), 0.7) @attr.gpu def test_linear_model_gpu(self): self.assertGreater(self.model.accuracy(True), 0.7)
class TestRMSprop(TestCase): def setUp(self): self.optimizer = RMSprop(0.1) self.model = LinearModel(self.optimizer) def test_linear_model_cpu(self): self.assertGreater(self.model.accuracy(False), 0.7) @attr.gpu def test_linear_model_gpu(self): self.assertGreater(self.model.accuracy(True), 0.7)
class TestAdaDelta(TestCase): def setUp(self): self.optimizer = AdaDelta(eps=1e-5) self.model = LinearModel(self.optimizer) def test_linear_model_cpu(self): self.assertGreater(self.model.accuracy(False), 0.75) @attr.gpu def test_linear_model_gpu(self): self.assertGreater(self.model.accuracy(True), 0.75)