def test_parallel_hubness_equal_serial_hubness_similarity_based(self):
     similarity = random_sparse_matrix(size=1000)
     S_k_p, D_k_p, N_k_p = hubness_p(
         similarity, k=5, metric='similarity', verbose=False, n_jobs=-1)
     S_k_s, D_k_s, N_k_s = hubness_s(
         similarity, k=5, metric='similarity', verbose=False)
     result = np.allclose(S_k_p, S_k_s) & \
         np.allclose(D_k_p, D_k_s) & \
         np.allclose(N_k_p, N_k_s)
     return self.assertTrue(result)
示例#2
0
 def setUp(self):
     np.random.seed(626)
     self.matrix_n = 500
     self.density = 0.02
     self.similarity = random_sparse_matrix(
         size=self.matrix_n, density=self.density)