Commit 198dc472 authored by lucas_miranda's avatar lucas_miranda
Browse files

Modified cluster purity computation. Instead of KNN, we now look at...

Modified cluster purity computation. Instead of KNN, we now look at neighborhoods of a predefined radius
parent 89930d71
......@@ -266,11 +266,11 @@ class neighbor_cluster_purity(tf.keras.callbacks.Callback):
for i, sample in enumerate(random_idxs):
neighborhood = pdist[sample] < self.r
z = groups[neighborhood]
neigh_entropy = K.sum(tf.multiply(z + 1e-5, tf.math.log(z) + 1e-5), axis=self.axis)
purity_vector[i] = (
np.sum(hard_groups[neighborhood] == hard_groups[sample])
/ np.sum(neighborhood)
* np.max(groups[sample])
neigh_entropy / np.sum(neighborhood)
)
writer = tf.summary.create_file_writer(self.log_dir)
......
Supports Markdown
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