Completed
Branch master (87644b)
by Christiaan
01:33
created

ModelGenerationSuite.test_regularization_is_float()   A

Complexity

Conditions 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
c 2
b 0
f 0
dl 0
loc 4
rs 10
1
from mcfly import modelgen
2
import numpy as np
3
from nose.tools import assert_equal, assert_equals
4
5
import unittest
6
7
8
class ModelGenerationSuite(unittest.TestCase):
9
    """Basic test cases."""
10
11
    def test_regularization_is_float(self):
12
        """ Regularization should be a float. """
13
        reg = modelgen.get_regularization(0, 5)
14
        assert type(reg) == np.float
15
16
17
    def test_regularization_0size_interval(self):
18
        """ Regularization from zero size interval [2,2] should be 10^-2. """
19
        reg = modelgen.get_regularization(2, 2)
20
        assert_equal(reg, 0.01)
21
22
23
    def test_base_hyper_parameters_reg(self):
24
        """ Base hyper parameter set should contain regularization. """
25
        hyper_parameter_set = modelgen.generate_base_hyper_parameter_set()
26
        assert 'regularization_rate' in hyper_parameter_set.keys()
27
28
29
    def setUp(self):
30
        np.random.seed(1234)
31
32
if __name__ == '__main__':
33
    unittest.main()