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
Pipeline #95916 passed with stages
in 35 minutes and 57 seconds
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment