示例#1
0
 def test_rank_floats_and_ints(self):
     row = [5.0, 4.0, 3.0, 2, 1]
     exp_ranks = np.array([5, 4, 3, 2, 1])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#2
0
 def test_rank_few_floats(self):
     row = [6.6, 1.1, 3.3, 1.1]
     exp_ranks = np.array([4, 1.5, 3, 1.5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#3
0
 def test_rank_basic(self):
     row = [1, 2, 3, 4, 5]
     exp_ranks = np.array([1, 2, 3, 4, 5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#4
0
 def test_rank_same_num(self):
     row = [1.0, 1, 1]
     exp_ranks = np.array([2, 2, 2])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#5
0
 def test_rank_mostly_same_num(self):
     row = [9, 9, 3, 9, 9]
     exp_ranks = np.array([3.5, 3.5, 1, 3.5, 3.5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#6
0
 def test_rank_few_floats(self):
     row = [6.6, 1.1, 3.3, 1.1]
     exp_ranks = np.array([4, 1.5, 3, 1.5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#7
0
 def test_rank_floats(self):
     row = [1.0, 2.0, 1.0, 4.0, 5.0]
     exp_ranks = np.array([1.5, 3, 1.5, 4, 5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#8
0
 def test_rank_mostly_same_num(self):
     row = [9, 9, 3, 9, 9]
     exp_ranks = np.array([3.5, 3.5, 1, 3.5, 3.5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#9
0
 def test_rank_same_num(self):
     row = [1.0, 1, 1]
     exp_ranks = np.array([2, 2, 2])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#10
0
 def test_rank_floats(self):
     row = [1.0, 2.0, 1.0, 4.0, 5.0]
     exp_ranks = np.array([1.5, 3, 1.5, 4, 5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#11
0
 def test_rank_floats_and_ints(self):
     row = [5.0, 4.0, 3.0, 2, 1]
     exp_ranks = np.array([5, 4, 3, 2, 1])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)
示例#12
0
 def test_rank_basic(self):
     row = [1, 2, 3, 4, 5]
     exp_ranks = np.array([1, 2, 3, 4, 5])
     ranks = spearman._rankForSpearman(np.array(row))
     self.nearly_same(ranks, exp_ranks, absTol=1e-18, relTol=1e-12)