8000
We read every piece of feedback, and take your input very seriously.
1 parent 57e0c9e commit f4bae4bCopy full SHA for f4bae4b
examples/manifold/plot_compare_methods.py
@@ -182,7 +182,7 @@ def add_2d_scatter(ax, points, points_color, title=None):
182
# Read more in the :ref:`User Guide <spectral_embedding>`.
183
184
spectral = manifold.SpectralEmbedding(
185
- n_components=n_components, n_neighbors=n_neighbors
+ n_components=n_components, n_neighbors=n_neighbors, random_state=42
186
)
187
S_spectral = spectral.fit_transform(S_points)
188
examples/manifold/plot_manifold_sphere.py
@@ -78,7 +78,7 @@
78
t0 = time()
79
trans_data = (
80
manifold.LocallyLinearEmbedding(
81
- n_neighbors=n_neighbors, n_components=2, method=method
+ n_neighbors=n_neighbors, n_components=2, method=method, random_state=42
82
83
.fit_transform(sphere_data)
84
.T
@@ -112,7 +112,7 @@
112
113
# Perform Multi-dimensional scaling.
114
115
-mds = manifold.MDS(2, max_iter=100, n_init=1, normalized_stress="auto")
+mds = manifold.MDS(2, max_iter=100, n_init=1, normalized_stress="auto", random_state=42)
116
trans_data = mds.fit_transform(sphere_data).T
117
t1 = time()
118
print("MDS: %.2g sec" % (t1 - t0))
@@ -126,7 +126,9 @@
126
127
# Perform Spectral Embedding.
128
129
-se = manifold.SpectralEmbedding(n_components=2, n_neighbors=n_neighbors)
+se = manifold.SpectralEmbedding(
130
+ n_components=2, n_neighbors=n_neighbors, random_state=42
131
+)
132
trans_data = se.fit_transform(sphere_data).T
133
134
print("Spectral Embedding: %.2g sec" % (t1 - t0))
examples/miscellaneous/plot_kernel_approximation.py
@@ -72,18 +72,24 @@
72
73
# Create a classifier: a support vector classifier
74
kernel_svm = svm.SVC(gamma=0.2)
75
-linear_svm = svm.LinearSVC(dual="auto")
+linear_svm = svm.LinearSVC(dual="auto", random_state=42)
76
77
# create pipeline from kernel approximation
# and linear svm
feature_map_fourier = RBFSampler(gamma=0.2, random_state=1)
feature_map_nystroem = Nystroem(gamma=0.2, random_state=1)
fourier_approx_svm = pipeline.Pipeline(
- [("feature_map", feature_map_fourier), ("svm", svm.LinearSVC(dual="auto"))]
+ [
+ ("feature_map", feature_map_fourier),
+ ("svm", svm.LinearSVC(dual="auto", random_state=42)),
85
+ ]
86
87
88
nystroem_approx_svm = pipeline.Pipeline(
- [("feature_map", feature_map_nystroem), ("svm", svm.LinearSVC(dual="auto"))]
89
90
+ ("feature_map", feature_map_nystroem),
91
92
93
94
95
# fit and predict using linear and kernel svm:
@@ -192,7 +198,7 @@
192
198
193
199
# visualize the decision surface, projected down to the first
194
200
# two principal components of the dataset
195
-pca = PCA(n_components=8).fit(data_train)
201
+pca = PCA(n_components=8, random_state=42).fit(data_train)
196
202
197
203
X = pca.transform(data_train)
204