Skip to content

Commit

Permalink
Test for KDE underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mglisse committed Jun 17, 2024
1 parent 2e605c7 commit d857587
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/python/test/test_tomato.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,13 @@ def test_tomato_1():
assert t.diagram_.size == 0
assert t.max_weight_per_cc_.size == 1
t.plot_diagram()


def test_tomato_kde_underflow():
# 1D construction with 2 Gaussians, embedded in high dimension
X = np.zeros((200, 1000))
X[:100, 0] = np.random.default_rng().normal(-2, 1, 100)
X[100:, 0] = np.random.default_rng().normal(2, 1, 100)
# X[:,0].sort()
t = Tomato(density_type="KDE").fit(X)
assert (t.weights_ != 0).all()

0 comments on commit d857587

Please sign in to comment.