Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7f3888d

Browse filesBrowse files
adrinjalaliItay
authored and
Itay
committed
MNT Update black to 23.3.0 (scikit-learn#26110)
1 parent 97b11d7 commit 7f3888d
Copy full SHA for 7f3888d

File tree

Expand file treeCollapse file tree

183 files changed

+807
-757
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

183 files changed

+807
-757
lines changed

‎.pre-commit-config.yaml

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- repo: https://github.com/psf/black
9-
rev: 22.3.0
9+
rev: 23.3.0
1010
hooks:
1111
- id: black
1212
- repo: https://github.com/pycqa/flake8

‎benchmarks/bench_20newsgroups.py

Copy file name to clipboardExpand all lines: benchmarks/bench_20newsgroups.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# Data
2929

3030
if __name__ == "__main__":
31-
3231
parser = argparse.ArgumentParser()
3332
parser.add_argument(
3433
"-e", "--estimators", nargs="+", required=True, choices=ESTIMATORS

‎benchmarks/bench_feature_expansions.py

Copy file name to clipboardExpand all lines: benchmarks/bench_feature_expansions.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
fig, axes = plt.subplots(nrows=len(densities), ncols=1, figsize=(8, 10))
3737
for density, ax in zip(densities, axes):
38-
3938
ax.plot(
4039
dimensionalities,
4140
csr_times[density] / trials,

‎benchmarks/bench_glm.py

Copy file name to clipboardExpand all lines: benchmarks/bench_glm.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
if __name__ == "__main__":
13-
1413
import matplotlib.pyplot as plt
1514

1615
n_iter = 40
@@ -22,7 +21,6 @@
2221
dimensions = 500 * np.arange(1, n_iter + 1)
2322

2423
for i in range(n_iter):
25-
2624
print("Iteration %s of %s" % (i, n_iter))
2725

2826
n_samples, n_features = 10 * i + 3, 10 * i + 3

‎benchmarks/bench_isolation_forest.py

Copy file name to clipboardExpand all lines: benchmarks/bench_isolation_forest.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def print_outlier_ratio(y):
5252

5353
# Loop over all datasets for fitting and scoring the estimator:
5454
for dat in datasets:
55-
5655
# Loading and vectorizing the data:
5756
print("====== %s ======" % dat)
5857
print("--- Fetching data...")

‎benchmarks/bench_kernel_pca_solvers_time_vs_n_components.py

Copy file name to clipboardExpand all lines: benchmarks/bench_kernel_pca_solvers_time_vs_n_components.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
r_time = np.empty((len(n_compo_range), n_iter)) * np.nan
8383
# loop
8484
for j, n_components in enumerate(n_compo_range):
85-
8685
n_components = int(n_components)
8786
print("Performing kPCA with n_components = %i" % n_components)
8887

‎benchmarks/bench_kernel_pca_solvers_time_vs_n_samples.py

Copy file name to clipboardExpand all lines: benchmarks/bench_kernel_pca_solvers_time_vs_n_samples.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383

8484
# loop
8585
for j, n_samples in enumerate(n_samples_range):
86-
8786
n_samples = int(n_samples)
8887
print("Performing kPCA with n_samples = %i" % n_samples)
8988

‎benchmarks/bench_mnist.py

Copy file name to clipboardExpand all lines: benchmarks/bench_mnist.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ def load_data(dtype=np.float32, order="F"):
223223
)
224224
print("-" * 60)
225225
for name in sorted(args["classifiers"], key=error.get):
226-
227226
print(
228227
"{0: <23} {1: >10.2f}s {2: >10.2f}s {3: >12.4f}".format(
229228
name, train_time[name], test_time[name], error[name]

‎benchmarks/bench_online_ocsvm.py

Copy file name to clipboardExpand all lines: benchmarks/bench_online_ocsvm.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def print_outlier_ratio(y):
6565
results_online = np.empty((len(datasets), n_axis + 5))
6666

6767
for dat, dataset_name in enumerate(datasets):
68-
6968
print(dataset_name)
7069

7170
# Loading datasets
@@ -133,7 +132,6 @@ def print_outlier_ratio(y):
133132
gamma = 1 / n_features # OCSVM default parameter
134133

135134
for random_state in random_states:
136-
137135
print("random state: %s" % random_state)
138136

139137
X, y = shuffle(X, y, random_state=random_state)

‎benchmarks/bench_plot_fastkmeans.py

Copy file name to clipboardExpand all lines: benchmarks/bench_plot_fastkmeans.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
def compute_bench(samples_range, features_range):
11-
1211
it = 0
1312
results = defaultdict(lambda: [])
1413
chunk = 100

‎benchmarks/bench_plot_hierarchical.py

Copy file name to clipboardExpand all lines: benchmarks/bench_plot_hierarchical.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
def compute_bench(samples_range, features_range):
11-
1211
it = 0
1312
results = defaultdict(lambda: [])
1413

‎benchmarks/bench_plot_lasso_path.py

Copy file name to clipboardExpand all lines: benchmarks/bench_plot_lasso_path.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
def compute_bench(samples_range, features_range):
18-
1918
it = 0
2019

2120
results = defaultdict(lambda: [])

‎benchmarks/bench_plot_omp_lars.py

Copy file name to clipboardExpand all lines: benchmarks/bench_plot_omp_lars.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
def compute_bench(samples_range, features_range):
17-
1817
it = 0
1918

2019
results = dict()

‎benchmarks/bench_plot_randomized_svd.py

Copy file name to clipboardExpand all lines: benchmarks/bench_plot_randomized_svd.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ def scalable_frobenius_norm_discrepancy(X, U, s, V):
342342

343343

344344
def bench_a(X, dataset_name, power_iter, n_oversamples, n_comps):
345-
346345
all_time = defaultdict(list)
347346
if enable_spectral_norm:
348347
all_spectral = defaultdict(list)
@@ -398,7 +397,6 @@ def bench_a(X, dataset_name, power_iter, n_oversamples, n_comps):
398397

399398

400399
def bench_b(power_list):
401-
402400
n_samples, n_features = 1000, 10000
403401
data_params = {
404402
"n_samples": n_samples,

‎benchmarks/bench_plot_svd.py

Copy file name to clipboardExpand all lines: benchmarks/bench_plot_svd.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
def compute_bench(samples_range, features_range, n_iter=3, rank=50):
16-
1716
it = 0
1817

1918
results = defaultdict(lambda: [])

‎benchmarks/bench_sample_without_replacement.py

Copy file name to clipboardExpand all lines: benchmarks/bench_sample_without_replacement.py
+28-22Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,47 +105,53 @@ def bench_sample(sampling, n_population, n_samples):
105105

106106
###########################################################################
107107
# Set Python core input
108-
sampling_algorithm[
109-
"python-core-sample"
110-
] = lambda n_population, n_sample: random.sample(range(n_population), n_sample)
108+
sampling_algorithm["python-core-sample"] = (
109+
lambda n_population, n_sample: random.sample(range(n_population), n_sample)
110+
)
111111

112112
###########################################################################
113113
# Set custom automatic method selection
114-
sampling_algorithm[
115-
"custom-auto"
116-
] = lambda n_population, n_samples, random_state=None: sample_without_replacement(
117-
n_population, n_samples, method="auto", random_state=random_state
114+
sampling_algorithm["custom-auto"] = (
115+
lambda n_population, n_samples, random_state=None: sample_without_replacement(
116+
n_population, n_samples, method="auto", random_state=random_state
117+
)
118118
)
119119

120120
###########################################################################
121121
# Set custom tracking based method
122-
sampling_algorithm[
123-
"custom-tracking-selection"
124-
] = lambda n_population, n_samples, random_state=None: sample_without_replacement(
125-
n_population, n_samples, method="tracking_selection", random_state=random_state
122+
sampling_algorithm["custom-tracking-selection"] = (
123+
lambda n_population, n_samples, random_state=None: sample_without_replacement(
124+
n_population,
125+
n_samples,
126+
method="tracking_selection",
127+
random_state=random_state,
128+
)
126129
)
127130

128131
###########################################################################
129132
# Set custom reservoir based method
130-
sampling_algorithm[
131-
"custom-reservoir-sampling"
132-
] = lambda n_population, n_samples, random_state=None: sample_without_replacement(
133-
n_population, n_samples, method="reservoir_sampling", random_state=random_state
133+
sampling_algorithm["custom-reservoir-sampling"] = (
134+
lambda n_population, n_samples, random_state=None: sample_without_replacement(
135+
n_population,
136+
n_samples,
137+
method="reservoir_sampling",
138+
random_state=random_state,
139+
)
134140
)
135141

136142
###########################################################################
137143
# Set custom reservoir based method
138-
sampling_algorithm[
139-
"custom-pool"
140-
] = lambda n_population, n_samples, random_state=None: sample_without_replacement(
141-
n_population, n_samples, method="pool", random_state=random_state
144+
sampling_algorithm["custom-pool"] = (
145+
lambda n_population, n_samples, random_state=None: sample_without_replacement(
146+
n_population, n_samples, method="pool", random_state=random_state
147+
)
142148
)
143149

144150
###########################################################################
145151
# Numpy permutation based
146-
sampling_algorithm[
147-
"numpy-permutation"
148-
] = lambda n_population, n_sample: np.random.permutation(n_population)[:n_sample]
152+
sampling_algorithm["numpy-permutation"] = (
153+
lambda n_population, n_sample: np.random.permutation(n_population)[:n_sample]
154+
)
149155

150156
###########################################################################
151157
# Remove unspecified algorithm

‎benchmarks/bench_text_vectorizers.py

Copy file name to clipboardExpand all lines: benchmarks/bench_text_vectorizers.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def f():
4545
[CountVectorizer, TfidfVectorizer, HashingVectorizer],
4646
[("word", (1, 1)), ("word", (1, 2)), ("char", (4, 4)), ("char_wb", (4, 4))],
4747
):
48-
4948
bench = {"vectorizer": Vectorizer.__name__}
5049
params = {"analyzer": analyzer, "ngram_range": ngram_range}
5150
bench.update(params)

‎benchmarks/bench_tree.py

Copy file name to clipboardExpand all lines: benchmarks/bench_tree.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def bench_scikit_tree_regressor(X, Y):
6060

6161

6262
if __name__ == "__main__":
63-
6463
print("============================================")
6564
print("Warning: this is going to take a looong time")
6665
print("============================================")

‎benchmarks/bench_tsne_mnist.py

Copy file name to clipboardExpand all lines: benchmarks/bench_tsne_mnist.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ def sanitize(filename):
129129
try:
130130
from bhtsne.bhtsne import run_bh_tsne
131131
except ImportError as e:
132-
raise ImportError(
133-
"""\
132+
raise ImportError("""\
134133
If you want comparison with the reference implementation, build the
135134
binary from source (https://github.com/lvdmaaten/bhtsne) in the folder
136135
benchmarks/bhtsne and add an empty `__init__.py` file in the folder:
@@ -140,8 +139,7 @@ def sanitize(filename):
140139
$ g++ sptree.cpp tsne.cpp tsne_main.cpp -o bh_tsne -O2
141140
$ touch __init__.py
142141
$ cd ..
143-
"""
144-
) from e
142+
""") from e
145143

146144
def bhtsne(X):
147145
"""Wrapper for the reference lvdmaaten/bhtsne implementation."""
@@ -160,7 +158,6 @@ def bhtsne(X):
160158
methods.append(("lvdmaaten/bhtsne", bhtsne))
161159

162160
if args.profile:
163-
164161
try:
165162
from memory_profiler import profile
166163
except ImportError as e:

‎build_tools/generate_authors_table.py

Copy file name to clipboardExpand all lines: build_tools/generate_authors_table.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def generate_list(contributors):
172172

173173

174174
if __name__ == "__main__":
175-
176175
(
177176
core_devs,
178177
emeritus,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.