Skip to content
Snippets Groups Projects
Commit a1fe2c45 authored by Lucas Miranda's avatar Lucas Miranda
Browse files

Fixed a bug in model_utils.py that yielded nan entropy values when there were...

Fixed a bug in model_utils.py that yielded nan entropy values when there were no neighbors in the radius and the selected cluster was 0
parent d3a17c01
No related branches found
No related tags found
No related merge requests found
Pipeline #95916 passed
......@@ -278,9 +278,9 @@ class neighbor_cluster_purity(tf.keras.callbacks.Callback):
z = hard_groups[neighborhood]
# Compute Shannon entropy across samples
neigh_entropy = entropy(z)
neigh_entropy = entropy(np.bincount(z))
purity_vector[i] = neigh_entropy if not np.isnan(neigh_entropy) else 0.0
purity_vector[i] = neigh_entropy
neighbor_number[i] = np.sum(neighborhood)
# Compute weights multiplying neighbor number and target confidence
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment