Spaces:
Running
Running
Commit
·
8c5950d
1
Parent(s):
5f6d483
Try UMAP
Browse files
app.py
CHANGED
|
@@ -23,6 +23,7 @@ import matplotlib.colors as mcolors
|
|
| 23 |
import zipfile
|
| 24 |
import tempfile
|
| 25 |
from kneed import KneeLocator
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
class RelativeScaler(BaseEstimator, TransformerMixin):
|
|
@@ -561,6 +562,12 @@ def compute_global_regression(df_combined, embedding_cols, tsne_params, df_f1, r
|
|
| 561 |
("pca", PCA(n_components=N_COMPONENTS)),
|
| 562 |
("rel_scaler", RelativeScaler())
|
| 563 |
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 564 |
else:
|
| 565 |
reducer = TSNE(n_components=2, random_state=42,
|
| 566 |
perplexity=tsne_params["perplexity"],
|
|
@@ -832,7 +839,7 @@ def run_model(model_name):
|
|
| 832 |
return
|
| 833 |
|
| 834 |
st.markdown('<h6 class="sub-title">Select Dimensionality Reduction Method</h6>', unsafe_allow_html=True)
|
| 835 |
-
reduction_method = st.selectbox("", options=["PCA", "t-SNE"], key=f"reduction_{model_name}")
|
| 836 |
|
| 837 |
distance_metric = st.selectbox("Select Distance Metric:",
|
| 838 |
options=["Euclidean", "Wasserstein", "KL"],
|
|
|
|
| 23 |
import zipfile
|
| 24 |
import tempfile
|
| 25 |
from kneed import KneeLocator
|
| 26 |
+
import umap
|
| 27 |
|
| 28 |
|
| 29 |
class RelativeScaler(BaseEstimator, TransformerMixin):
|
|
|
|
| 562 |
("pca", PCA(n_components=N_COMPONENTS)),
|
| 563 |
("rel_scaler", RelativeScaler())
|
| 564 |
])
|
| 565 |
+
elif reduction_method == "UMAP":
|
| 566 |
+
reducer = umap.UMAP(n_components=N_COMPONENTS,
|
| 567 |
+
random_state=42,
|
| 568 |
+
n_neighbors=15,
|
| 569 |
+
min_dist=0.1,
|
| 570 |
+
metric='cosine')
|
| 571 |
else:
|
| 572 |
reducer = TSNE(n_components=2, random_state=42,
|
| 573 |
perplexity=tsne_params["perplexity"],
|
|
|
|
| 839 |
return
|
| 840 |
|
| 841 |
st.markdown('<h6 class="sub-title">Select Dimensionality Reduction Method</h6>', unsafe_allow_html=True)
|
| 842 |
+
reduction_method = st.selectbox("", options=["PCA", "t-SNE", "UMAP"], key=f"reduction_{model_name}")
|
| 843 |
|
| 844 |
distance_metric = st.selectbox("Select Distance Metric:",
|
| 845 |
options=["Euclidean", "Wasserstein", "KL"],
|