Spaces:
Runtime error
Runtime error
Benjamin Bossan
commited on
Commit
·
e04e7d0
1
Parent(s):
9be4332
Set random seed for all datasets
Browse files
app.py
CHANGED
|
@@ -68,6 +68,7 @@ def get_moons(n_clusters):
|
|
| 68 |
|
| 69 |
|
| 70 |
def get_noise(n_clusters):
|
|
|
|
| 71 |
X, labels = np.random.rand(N_SAMPLES, 2), np.random.randint(0, n_clusters, size=(N_SAMPLES,))
|
| 72 |
return normalize(X), labels
|
| 73 |
|
|
@@ -90,6 +91,7 @@ def get_varied(n_clusters):
|
|
| 90 |
|
| 91 |
def get_spiral(n_clusters):
|
| 92 |
# from https://scikit-learn.org/stable/auto_examples/cluster/plot_agglomerative_clustering.html
|
|
|
|
| 93 |
t = 1.5 * np.pi * (1 + 3 * np.random.rand(1, N_SAMPLES))
|
| 94 |
x = t * np.cos(t)
|
| 95 |
y = t * np.sin(t)
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
def get_noise(n_clusters):
|
| 71 |
+
np.random.seed(SEED)
|
| 72 |
X, labels = np.random.rand(N_SAMPLES, 2), np.random.randint(0, n_clusters, size=(N_SAMPLES,))
|
| 73 |
return normalize(X), labels
|
| 74 |
|
|
|
|
| 91 |
|
| 92 |
def get_spiral(n_clusters):
|
| 93 |
# from https://scikit-learn.org/stable/auto_examples/cluster/plot_agglomerative_clustering.html
|
| 94 |
+
np.random.seed(SEED)
|
| 95 |
t = 1.5 * np.pi * (1 + 3 * np.random.rand(1, N_SAMPLES))
|
| 96 |
x = t * np.cos(t)
|
| 97 |
y = t * np.sin(t)
|