Esempio n. 1
0
    def setUp(self):
        self.testmodel = model.Model()

        self.learning_rate = 0.08
        self.layer_dims = [1, 10, 1]
        self.params = {'W1': np.ones((10, 1)), 'b1': np.ones((10, 1))}
        self.datafile = io.BytesIO()

        with h5.File(self.datafile, 'w') as df:
            df.create_dataset("learning_rate", data=self.learning_rate)
            df.create_dataset("layer_dims", data=self.layer_dims)
            df.create_dataset("params/W1", data=self.params['W1'])
            df.create_dataset("params/b1", data=self.params['b1'])
Esempio n. 2
0
 def setUp(self):
     self.testmodel = model.Model()
     self.X = np.ones((1, 1))
     self.Y = np.ones((1, 1))
     self.iterations = 100
     self.interval = 10
Esempio n. 3
0
    def test_all_layers_must_be_greater_than_zero(self):
        testmodel = model.Model()

        with self.assertRaises(AssertionError):
            testmodel.layer_dims = [0, 0]
Esempio n. 4
0
    def test_learning_rate_is_less_than_or_equal_to_one(self):
        testmodel = model.Model()

        with self.assertRaises(AssertionError):
            testmodel.learning_rate = 2
Esempio n. 5
0
    def test_learning_rate_is_greater_than_zero(self):
        testmodel = model.Model()

        with self.assertRaises(AssertionError):
            testmodel.learning_rate = 0
Esempio n. 6
0
    def test_has_a_sensible_default_for_layer_dims(self):
        testmodel = model.Model()

        self.assertTrue(testmodel.layer_dims == [1, 1])
Esempio n. 7
0
 def setUp(self):
     self.testmodel = model.Model()
     self.datafile = io.BytesIO()
Esempio n. 8
0
    def test_has_a_sensible_default_for_learning_rate(self):
        testmodel = model.Model()

        self.assertTrue(testmodel.learning_rate == 0.0075)