コード例 #1
0
 def test_parallel_hubness_equal_serial_hubness_distance_based(self):
     S_k_p, D_k_p, N_k_p = hubness_p(
         self.distance, k=5, metric='distance', verbose=True, n_jobs=2)
     S_k_s, D_k_s, N_k_s = hubness_s(
         self.distance, k=5, metric='distance', 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 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)