Commit ba61a305 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 757f4126
Pipeline #95655 canceled with stages
in 24 minutes and 3 seconds
...@@ -870,8 +870,8 @@ class coordinates: ...@@ -870,8 +870,8 @@ class coordinates:
variational: bool = True, variational: bool = True,
reg_cat_clusters: bool = False, reg_cat_clusters: bool = False,
reg_cluster_variance: bool = False, reg_cluster_variance: bool = False,
knn_neighbors: int = 100, entropy_radius: float = 0.75,
knn_samples: int = 10000, entropy_samples: int = 10000,
) -> Tuple: ) -> Tuple:
""" """
Annotates coordinates using an unsupervised autoencoder. Annotates coordinates using an unsupervised autoencoder.
...@@ -932,8 +932,8 @@ class coordinates: ...@@ -932,8 +932,8 @@ class coordinates:
variational=variational, variational=variational,
reg_cat_clusters=reg_cat_clusters, reg_cat_clusters=reg_cat_clusters,
reg_cluster_variance=reg_cluster_variance, reg_cluster_variance=reg_cluster_variance,
knn_neighbors=knn_neighbors, entropy_radius=entropy_radius,
knn_samples=knn_samples, entropy_samples=entropy_samples,
) )
# returns a list of trained tensorflow models # returns a list of trained tensorflow models
......
...@@ -264,7 +264,7 @@ class neighbor_cluster_purity(tf.keras.callbacks.Callback): ...@@ -264,7 +264,7 @@ class neighbor_cluster_purity(tf.keras.callbacks.Callback):
for i, sample in enumerate(random_idxs): for i, sample in enumerate(random_idxs):
neighborhood = pdist[sample] < self.r neighborhood = pdist[sample] < self.r
z = groups[neighborhood] z = hard_groups[neighborhood]
# Compute Shannon entropy across samples # Compute Shannon entropy across samples
neigh_entropy = entropy(z) neigh_entropy = entropy(z)
......
...@@ -117,7 +117,7 @@ def test_autoencoder_fitting( ...@@ -117,7 +117,7 @@ def test_autoencoder_fitting(
phenotype_class=pheno_class, phenotype_class=pheno_class,
predictor=predictor, predictor=predictor,
variational=variational, variational=variational,
entropy_neighbors=0.75, entropy_radius=0.75,
entropy_samples=10, entropy_samples=10,
) )
......
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