Esempio n. 1
0
 def test_mse(self):
     ms = MSE()
     assert ms.value == 0.0
     refs = CPUTensor([0.00, 1, 0.7, -0.4])
     preds = CPUTensor([0.2, -1, 0.5, 2.4])
     ms.add(refs, preds)
     assert abs(ms.report() -
                ((0.2**2 + 2**2 + 0.2**2 + 2.8**2) / 4.0)) < 1e-5
Esempio n. 2
0
 def test_mse(self):
     ms = MSE()
     assert ms.value == 0.0
     refs = CPUTensor([0.00,  1, 0.7, -0.4])
     preds = CPUTensor([0.2, -1, 0.5,  2.4])
     ms.add(refs, preds)
     assert abs(ms.report() -
                ((0.2**2 + 2**2 + 0.2**2 + 2.8**2) / 4.0)) < 1e-5
Esempio n. 3
0
 def test_mse_mat(self):
     ms = MSE()
     assert ms.value == 0.0
     assert ms.rec_count == 0.0
     refs = CPUTensor([[0, 1, 0.7], [0.5, -3, 0]])
     preds = CPUTensor([[0.2, 1, 0.5], [0, -5.5, 0.10]])
     ms.add(refs, preds)
     assert abs(ms.report() - (
         (0.2**2 + 0**2 + 0.2**2 + 0.5**2 + 2.5**2 + .10**2) / 6.0)) < 1e-6
Esempio n. 4
0
 def test_mse_mat(self):
     ms = MSE()
     assert ms.value == 0.0
     assert ms.rec_count == 0.0
     refs = CPUTensor([[0, 1, 0.7],
                       [0.5, -3, 0]])
     preds = CPUTensor([[0.2, 1, 0.5],
                        [0, -5.5, 0.10]])
     ms.add(refs, preds)
     assert abs(ms.report() - ((0.2**2 + 0**2 + 0.2**2 +
                                0.5**2 + 2.5**2 + .10**2) / 6.0)) < 1e-6