Exemple #1
0
 def test_neural_cal_new_i(self):
     test_neural = Neural()
     test_neural.set_w1(2)
     test_neural.set_w2(3)
     test_neural.set_w3(4)
     test_neural.set_w4(5)
     test_neural.set_b(10)
     test_neural.set_i1(2)
     test_neural.set_i2(3)
     test_neural.set_i3(4)
     test_neural.set_i4(5)
     result = 64
     self.assertEqual(test_neural.cal_new_i(), result)
Exemple #2
0
 def test_neural_cal_cost(self):
     test_neural = Neural()
     test_neural.set_w1(2)
     test_neural.set_w2(3)
     test_neural.set_w3(4)
     test_neural.set_w4(5)
     test_neural.set_b(10)
     test_neural.set_i1(2)
     test_neural.set_i2(3)
     test_neural.set_i3(4)
     test_neural.set_i4(5)
     test_neural.set_target(100)
     result = 1296
     self.assertEqual(test_neural.cal_cost(), result)
Exemple #3
0
 def test_neural_learn_b(self):
     test_neural = Neural()
     test_neural.set_w1(2)
     test_neural.set_w2(3)
     test_neural.set_w3(4)
     test_neural.set_w4(5)
     test_neural.set_b(10)
     test_neural.set_i1(2)
     test_neural.set_i2(3)
     test_neural.set_i3(4)
     test_neural.set_i4(5)
     test_neural.set_target(100)
     result = 10.00072
     self.assertEqual(test_neural.learn_b(), result)
Exemple #4
0
 def test_neural_dcost_db(self):
     test_neural = Neural()
     test_neural.set_w1(2)
     test_neural.set_w2(3)
     test_neural.set_w3(4)
     test_neural.set_w4(5)
     test_neural.set_b(10)
     test_neural.set_i1(2)
     test_neural.set_i2(3)
     test_neural.set_i3(4)
     test_neural.set_i4(5)
     test_neural.set_target(100)
     result = -72
     self.assertEqual(test_neural.dcost_db(), result)