Spaces:
Sleeping
Sleeping
Commit
·
198e183
1
Parent(s):
171ba4c
Include Scaling for UMAP
Browse files
app.py
CHANGED
|
@@ -579,12 +579,16 @@ def compute_global_regression(df_combined, embedding_cols, tsne_params, df_f1, r
|
|
| 579 |
])
|
| 580 |
|
| 581 |
elif reduction_method == "UMAP":
|
| 582 |
-
reducer =
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
|
| 589 |
else:
|
| 590 |
reducer = TSNE(n_components=2, random_state=42,
|
|
@@ -1062,14 +1066,18 @@ def run_model(model_name):
|
|
| 1062 |
("pca", PCA(n_components=N_COMPONENTS)),
|
| 1063 |
("rel_scaler", RelativeScaler())
|
| 1064 |
])
|
| 1065 |
-
|
| 1066 |
elif reduction_method == "UMAP":
|
| 1067 |
-
reducer_real =
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
|
| 1071 |
-
|
| 1072 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1073 |
|
| 1074 |
reduced_real = reducer_real.fit_transform(df_real_only[embedding_cols].values)
|
| 1075 |
|
|
|
|
| 579 |
])
|
| 580 |
|
| 581 |
elif reduction_method == "UMAP":
|
| 582 |
+
reducer = Pipeline([
|
| 583 |
+
("umap", umap.UMAP(
|
| 584 |
+
n_components=N_COMPONENTS,
|
| 585 |
+
random_state=42,
|
| 586 |
+
n_neighbors=15,
|
| 587 |
+
min_dist=0.1,
|
| 588 |
+
metric='cosine'
|
| 589 |
+
)),
|
| 590 |
+
("rel_scaler", RelativeScaler())
|
| 591 |
+
])
|
| 592 |
|
| 593 |
else:
|
| 594 |
reducer = TSNE(n_components=2, random_state=42,
|
|
|
|
| 1066 |
("pca", PCA(n_components=N_COMPONENTS)),
|
| 1067 |
("rel_scaler", RelativeScaler())
|
| 1068 |
])
|
| 1069 |
+
|
| 1070 |
elif reduction_method == "UMAP":
|
| 1071 |
+
reducer_real = Pipeline([
|
| 1072 |
+
("umap", umap.UMAP(
|
| 1073 |
+
n_components=N_COMPONENTS,
|
| 1074 |
+
random_state=42,
|
| 1075 |
+
n_neighbors=15,
|
| 1076 |
+
min_dist=0.1,
|
| 1077 |
+
metric='cosine'
|
| 1078 |
+
)),
|
| 1079 |
+
("rel_scaler", RelativeScaler())
|
| 1080 |
+
])
|
| 1081 |
|
| 1082 |
reduced_real = reducer_real.fit_transform(df_real_only[embedding_cols].values)
|
| 1083 |
|