8000 pep8 · satra/scikit-learn@80c7451 · GitHub
[go: up one dir, main page]

Skip to content

Commit 80c7451

Browse files
jaquesgrobleramueller
authored andcommitted
pep8
1 parent 9a15d93 commit 80c7451

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

examples/manifold/plot_manifold_sphere.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@
5252

5353
# Create our sphere.
5454
random_state = check_random_state(0)
55-
p = random_state.rand(n_samples)*(2*np.pi-0.55)
56-
t = random_state.rand(n_samples)*np.pi
55+
p = random_state.rand(n_samples) * (2 * np.pi - 0.55)
56+
t = random_state.rand(n_samples) * np.pi
5757

5858
# Sever the poles from the sphere.
59-
indices = ((t < (np.pi-(np.pi/8))) & (t > ((np.pi/8))))
59+
indices = ((t < (np.pi - (np.pi / 8))) & (t > ((np.pi / 8))))
6060
colors = p[indices]
61-
x, y, z = np.sin(t[indices])*np.cos(p[indices]), \
62-
np.sin(t[indices])*np.sin(p[indices]), \
61+
x, y, z = np.sin(t[indices]) * np.cos(p[indices]), \
62+
np.sin(t[indices]) * np.sin(p[indices]), \
6363
np.cos(t[indices])
6464

6565
# Plot our dataset.
6666
fig = pl.figure(figsize=(15, 8))
6767
pl.suptitle("Manifold Learning with %i points, %i neighbors"
68-
% (1000, n_neighbors), fontsize=14)
68+
% (1000, n_neighbors), fontsize=14)
6969

7070
ax = fig.add_subplot(241, projection='3d')
7171
ax.scatter(x, y, z, c=p[indices], cmap=pl.cm.rainbow)
@@ -83,8 +83,9 @@
8383

8484
for i, method in enumerate(methods):
8585
t0 = time()
86-
trans_data = manifold.LocallyLinearEmbedding(n_neighbors, 2,
87-
method=method).fit_transform(sphere_data).T
86+
trans_data = manifold\
87+
.LocallyLinearEmbedding(n_neighbors, 2,
88+
method=method).fit_transform(sphere_data).T
8889
t1 = time()
8990
print "%s: %.2g sec" % (methods[i], t1 - t0)
9091

@@ -97,7 +98,8 @@
9798

9899
# Perform Isomap Manifold learning.
99100
t0 = time()
100-
trans_data = manifold.Isomap(n_neighbors, n_components=2).fit_transform(sphere_data).T
101+
trans_data = manifold.Isomap(n_neighbors, n_components=2)\
102+
.fit_transform(sphere_data).T
101103
t1 = time()
102104
print "%s: %.2g sec" % ('ISO', t1 - t0)
103105

@@ -123,4 +125,3 @@
123125
pl.axis('tight')
124126

125127
pl.show()
126-

0 commit comments

Comments
 (0)
0