diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2020-05-12 22:31:42 +0200 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2020-05-12 22:31:42 +0200 |
commit | c5fca5477cc6fff77acedf7b5324eb5f8b417ed3 (patch) | |
tree | 50687f72096e7185492697a0c298c1261b151e69 /src/python/test | |
parent | c87a1f10e048477d210ae0abd657da87bba1102a (diff) |
More test
Diffstat (limited to 'src/python/test')
-rwxr-xr-x | src/python/test/test_dtm.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/python/test/test_dtm.py b/src/python/test/test_dtm.py index 34d28d4d..8ab0cc44 100755 --- a/src/python/test/test_dtm.py +++ b/src/python/test/test_dtm.py @@ -75,3 +75,10 @@ def test_density_normalized(): expected = numpy.exp(-(queries ** 2).sum(-1) / 2) / (2 * math.pi) estimated = DTMDensity(k=150, normalize=True).fit(sample).transform(queries) assert estimated == pytest.approx(expected, rel=0.4) + + +def test_density(): + distances = [[0, 1, 10], [2, 0, 30], [1, 3, 5]] + density = DTMDensity(k=2, metric="neighbors", dim=1).fit_transform(distances) + expected = numpy.array([2.0, 1.0, 0.5]) + assert density == pytest.approx(expected) |