MCPcopy Create free account
hub / github.com/modAL-python/modAL / test_similarize_distance

Method test_similarize_distance

tests/core_tests.py:388–397  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

386class TestDensity(unittest.TestCase):
387
388 def test_similarize_distance(self):
389 from scipy.spatial.distance import cosine
390 sim = modAL.density.similarize_distance(cosine)
391 for _ in range(100):
392 for n_dim in range(1, 10):
393 X_1, X_2 = np.random.rand(n_dim), np.random.rand(n_dim)
394 np.testing.assert_almost_equal(
395 sim(X_1, X_2),
396 1/(1 + cosine(X_1, X_2))
397 )
398
399 def test_information_density(self):
400 for n_samples in range(1, 10):

Callers

nothing calls this directly

Calls 1

simFunction · 0.85

Tested by

no test coverage detected