Ejemplo n.º 1
0
 def test_update_parameters(self):
     """use the old parameters to check the updated parameters
     """
     print('BipartiteGraph -> Performing update_parameters test ...')
     sys.stdout.flush()
     bpgraph = BipartiteGraph(number_visibles=2, number_hiddens=3)
     old_param = copy.deepcopy(bpgraph.get_parameters())
     bpgraph.update_parameters(old_param)
     for each_new_param, each_old_param in \
             zip(bpgraph.get_parameters(), old_param):
         assert numx.all(each_new_param == 2 * each_old_param)
     print('successfully passed!')
     sys.stdout.flush()
Ejemplo n.º 2
0
 def test_get_parameters(self):
     """check whether the return of the function is iterable
     """
     print('BipartiteGraph -> Performing get_parameters test ...')
     sys.stdout.flush()
     bpgraph = BipartiteGraph(number_visibles=2, number_hiddens=3)
     parameter_list = bpgraph.get_parameters()
     # provide more error information here
     # check whether the parameter actually exisit in the instance?
     assert isinstance(parameter_list, Iterable)
     print('successfully passed!')
     sys.stdout.flush()