update and complete sample code

This commit is contained in:
2021-07-29 20:35:29 +02:00
parent 59c86b8e53
commit bd709131e4
8 changed files with 391 additions and 1343 deletions

View File

@@ -177,6 +177,8 @@ class Metrics:
k_all = k_all[mask]
c = c[mask]
radius = radius[mask]
if n_samples == 0:
return 0.0
kd = (
BallTree(c, metric="chebyshev")
if n_samples >= 20
@@ -192,7 +194,7 @@ class Metrics:
- np.mean(digamma(label_counts))
- np.mean(digamma(m_all + 1))
)
return max(0, mi)
return max(0.0, mi)
@staticmethod
def _nearest_distances(X, k=1):