Esempio n. 1
0
 def test_compute_prd_bad_num_angles(self):
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], num_angles=0)
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], num_angles=1)
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], num_angles=-1)
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], num_angles=1e6+1)
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], num_angles=2.5)
 def test_compute_prd_bad_num_angles(self):
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], num_angles=0)
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], num_angles=1)
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], num_angles=-1)
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], num_angles=1e6+1)
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], num_angles=2.5)
 def test_compute_prd_high_precision_low_recall(self):
   eval_dist = [1, 0]
   ref_dist = [0.5, 0.5]
   result = prd.compute_prd(eval_dist, ref_dist, num_angles=11)
   np.testing.assert_almost_equal([result[0][5], result[1][5]], [0.5, 0.5])
   np.testing.assert_almost_equal(result[1][1], 0.5)
   np.testing.assert_almost_equal(result[0][10], 1)
Esempio n. 4
0
 def test_compute_prd_high_precision_low_recall(self):
     eval_dist = [1, 0]
     ref_dist = [0.5, 0.5]
     result = prd.compute_prd(eval_dist, ref_dist, num_angles=11)
     np.testing.assert_almost_equal(
         [result[0][5], result[1][5]], [0.5, 0.5])
     np.testing.assert_almost_equal(result[1][1], 0.5)
     np.testing.assert_almost_equal(result[0][10], 1)
Esempio n. 5
0
 def test_compute_prd_bad_epsilon(self):
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], epsilon=0)
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], epsilon=1)
     with self.assertRaises(ValueError):
         prd.compute_prd([1], [1], epsilon=-1)
 def test_compute_prd_bad_epsilon(self):
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], epsilon=0)
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], epsilon=1)
   with self.assertRaises(ValueError):
     prd.compute_prd([1], [1], epsilon=-1)
Esempio n. 7
0
 def test_compute_prd_perfect_overlap(self):
     eval_dist = [1, 0]
     ref_dist = [1, 0]
     result = prd.compute_prd(eval_dist, ref_dist, num_angles=11)
     np.testing.assert_almost_equal([result[0][5], result[1][5]], [1, 1])
Esempio n. 8
0
 def test_compute_prd_no_overlap(self):
     eval_dist = [0, 1]
     ref_dist = [1, 0]
     result = np.ravel(prd.compute_prd(eval_dist, ref_dist))
     np.testing.assert_almost_equal(result, 0)
 def test_compute_prd_perfect_overlap(self):
   eval_dist = [1, 0]
   ref_dist = [1, 0]
   result = prd.compute_prd(eval_dist, ref_dist, num_angles=11)
   np.testing.assert_almost_equal([result[0][5], result[1][5]], [1, 1])
 def test_compute_prd_no_overlap(self):
   eval_dist = [0, 1]
   ref_dist = [1, 0]
   result = np.ravel(prd.compute_prd(eval_dist, ref_dist))
   np.testing.assert_almost_equal(result, 0)