Skip to content

Commit

Permalink
COSMIT pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
amueller committed Mar 5, 2013
1 parent fcad90d commit e42e530
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions benchmarks/bench_plot_nmf.py
Expand Up @@ -52,7 +52,7 @@ def alt_nnmf(V, r, max_iter=1000, tol=1e-3, R=None):
n, m = V.shape n, m = V.shape
if R == "svd": if R == "svd":
W, H = _initialize_nmf(V, r) W, H = _initialize_nmf(V, r)
elif R == None: elif R is None:
R = np.random.mtrand._rand R = np.random.mtrand._rand
W = np.abs(R.standard_normal((n, r))) W = np.abs(R.standard_normal((n, r)))
H = np.abs(R.standard_normal((r, m))) H = np.abs(R.standard_normal((r, m)))
Expand Down Expand Up @@ -94,7 +94,7 @@ def compute_bench(samples_range, features_range, rank=50, tolerance=1e-7):
print(m.reconstruction_err_, tend) print(m.reconstruction_err_, tend)


gc.collect() gc.collect()
print "benching nndsvda-nmf: " print("benching nndsvda-nmf: ")
tstart = time() tstart = time()
m = NMF(n_components=30, init='nndsvda', m = NMF(n_components=30, init='nndsvda',
tol=tolerance).fit(X) tol=tolerance).fit(X)
Expand Down Expand Up @@ -137,6 +137,7 @@ def compute_bench(samples_range, features_range, rank=50, tolerance=1e-7):


if __name__ == '__main__': if __name__ == '__main__':
from mpl_toolkits.mplot3d import axes3d # register the 3d projection from mpl_toolkits.mplot3d import axes3d # register the 3d projection
axes3d
import matplotlib.pyplot as plt import matplotlib.pyplot as plt


samples_range = np.linspace(50, 500, 3).astype(np.int) samples_range = np.linspace(50, 500, 3).astype(np.int)
Expand Down
2 changes: 1 addition & 1 deletion sklearn/tree/tree.py
Expand Up @@ -309,7 +309,7 @@ def fit(self, X, y,
max_features = self.n_features_ max_features = self.n_features_
elif isinstance(self.max_features, (numbers.Integral, np.integer)): elif isinstance(self.max_features, (numbers.Integral, np.integer)):
max_features = self.max_features max_features = self.max_features
else: # float else: # float
max_features = int(self.max_features * self.n_features_) max_features = int(self.max_features * self.n_features_)


if len(y) != n_samples: if len(y) != n_samples:
Expand Down

0 comments on commit e42e530

Please sign in to comment.