From efe42606c74be37e201bba7285ee572e34a9307e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 21:09:46 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v6.0.0) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 23.1.0 → 26.3.1](https://github.com/psf/black-pre-commit-mirror/compare/23.1.0...26.3.1) - [github.com/pycqa/flake8: 6.0.0 → 7.3.0](https://github.com/pycqa/flake8/compare/6.0.0...7.3.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d29162b8..cb1320a0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/psf/black - rev: 23.1.0 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.3.1 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.3.0 hooks: - id: flake8 types: [file, python] From 2976b2c8e92b096b0dbeddbe34d49d46881c4f2d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 21:10:24 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/cluster/plot_clustering.py | 1 + examples/cluster/plot_commonnn_data_sets.py | 1 - examples/cluster/plot_kmedoids_digits.py | 1 + examples/eigenpro/plot_eigenpro_synthetic.py | 1 + examples/kernel_approximation/plot_kernel_approximation.py | 1 + examples/plot_clara_digits.py | 1 + examples/plot_commonnn.py | 2 +- examples/plot_kmedoids.py | 2 +- examples/plot_robust_classification_toy.py | 2 +- examples/plot_robust_regression_toy.py | 1 + examples/robust/plot_robust_classification_diabete.py | 1 + examples/robust/plot_robust_regression_california_houses.py | 1 + sklearn_extra/cluster/_commonnn.py | 3 +-- sklearn_extra/cluster/tests/test_commonnn.py | 4 +--- sklearn_extra/cluster/tests/test_k_medoids.py | 2 +- sklearn_extra/kernel_approximation/__init__.py | 1 - sklearn_extra/kernel_approximation/test_fastfood.py | 1 - sklearn_extra/robust/robust_weighted_estimator.py | 2 -- sklearn_extra/robust/tests/test_mean_estimators.py | 1 - sklearn_extra/tests/test_common.py | 1 - 20 files changed, 14 insertions(+), 16 deletions(-) diff --git a/examples/cluster/plot_clustering.py b/examples/cluster/plot_clustering.py index b86c7265..52096296 100644 --- a/examples/cluster/plot_clustering.py +++ b/examples/cluster/plot_clustering.py @@ -14,6 +14,7 @@ parameterized, detects the outliers as a class of their own. """ + print(__doc__) import time diff --git a/examples/cluster/plot_commonnn_data_sets.py b/examples/cluster/plot_commonnn_data_sets.py index 34ddbb9e..08ba33e8 100644 --- a/examples/cluster/plot_commonnn_data_sets.py +++ b/examples/cluster/plot_commonnn_data_sets.py @@ -19,7 +19,6 @@ from sklearn import datasets from sklearn.preprocessing import StandardScaler - print(__doc__) diff --git a/examples/cluster/plot_kmedoids_digits.py b/examples/cluster/plot_kmedoids_digits.py index 8bb7ab11..10e30683 100644 --- a/examples/cluster/plot_kmedoids_digits.py +++ b/examples/cluster/plot_kmedoids_digits.py @@ -5,6 +5,7 @@ In this example we compare different pairwise distance metrics for K-Medoids. """ + import numpy as np import matplotlib.pyplot as plt diff --git a/examples/eigenpro/plot_eigenpro_synthetic.py b/examples/eigenpro/plot_eigenpro_synthetic.py index 802f8a57..62696e9a 100644 --- a/examples/eigenpro/plot_eigenpro_synthetic.py +++ b/examples/eigenpro/plot_eigenpro_synthetic.py @@ -11,6 +11,7 @@ the number of features exceeds 500, it begins to outperform SVM and shows more stability. """ + print(__doc__) import matplotlib diff --git a/examples/kernel_approximation/plot_kernel_approximation.py b/examples/kernel_approximation/plot_kernel_approximation.py index 6b8dab52..8b4603bd 100644 --- a/examples/kernel_approximation/plot_kernel_approximation.py +++ b/examples/kernel_approximation/plot_kernel_approximation.py @@ -41,6 +41,7 @@ in :ref:`kernel_approximation`. """ + print(__doc__) # Author: Gael Varoquaux diff --git a/examples/plot_clara_digits.py b/examples/plot_clara_digits.py index a703c948..8697307a 100644 --- a/examples/plot_clara_digits.py +++ b/examples/plot_clara_digits.py @@ -5,6 +5,7 @@ In this example we compare different computation time of K-Medoids and CLARA on the handwritten digits data. """ + import numpy as np import matplotlib.pyplot as plt import time diff --git a/examples/plot_commonnn.py b/examples/plot_commonnn.py index af48bdeb..c9da90d8 100644 --- a/examples/plot_commonnn.py +++ b/examples/plot_commonnn.py @@ -10,6 +10,7 @@ `. """ + import matplotlib.pyplot as plt import numpy as np @@ -18,7 +19,6 @@ from sklearn.datasets import make_blobs from sklearn.preprocessing import StandardScaler - print(__doc__) # ############################################################################# diff --git a/examples/plot_kmedoids.py b/examples/plot_kmedoids.py index 88856743..0d5a78fe 100644 --- a/examples/plot_kmedoids.py +++ b/examples/plot_kmedoids.py @@ -9,13 +9,13 @@ dataset. Read more in the :ref:`User Guide <_k_medoids>`. """ + import matplotlib.pyplot as plt import numpy as np from sklearn_extra.cluster import KMedoids from sklearn.datasets import make_blobs - print(__doc__) # ############################################################################# diff --git a/examples/plot_robust_classification_toy.py b/examples/plot_robust_classification_toy.py index c16d9ed4..74b80519 100644 --- a/examples/plot_robust_classification_toy.py +++ b/examples/plot_robust_classification_toy.py @@ -6,6 +6,7 @@ In this example we compare the RobustWeightedClassifier using SGDClassifier for classification with the vanilla SGDClassifier with various losses. """ + import matplotlib.pyplot as plt import numpy as np from sklearn_extra.robust import RobustWeightedClassifier @@ -13,7 +14,6 @@ from sklearn.datasets import make_blobs from sklearn.utils import shuffle - rng = np.random.RandomState(42) # Sample two Gaussian blobs diff --git a/examples/plot_robust_regression_toy.py b/examples/plot_robust_regression_toy.py index e47e18f2..f10d65fa 100644 --- a/examples/plot_robust_regression_toy.py +++ b/examples/plot_robust_regression_toy.py @@ -6,6 +6,7 @@ In this example we compare the RobustWeightedRegressor with various robust regression algorithms from scikit-learn. """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/robust/plot_robust_classification_diabete.py b/examples/robust/plot_robust_classification_diabete.py index 5b0dedd1..d0dc2085 100644 --- a/examples/robust/plot_robust_classification_diabete.py +++ b/examples/robust/plot_robust_classification_diabete.py @@ -8,6 +8,7 @@ We only compare the estimator with SGDClassifier as there is no robust classification estimator in scikit-learn. """ + import matplotlib.pyplot as plt import numpy as np from sklearn_extra.robust import RobustWeightedClassifier diff --git a/examples/robust/plot_robust_regression_california_houses.py b/examples/robust/plot_robust_regression_california_houses.py index b35d3695..4962d1c6 100644 --- a/examples/robust/plot_robust_regression_california_houses.py +++ b/examples/robust/plot_robust_regression_california_houses.py @@ -16,6 +16,7 @@ robustness in RobustWeightedRegressor can change and this is not so straightforward when using RANSAC and TheilSenRegressor. """ + import matplotlib.pyplot as plt import numpy as np from sklearn_extra.robust import RobustWeightedRegressor diff --git a/sklearn_extra/cluster/_commonnn.py b/sklearn_extra/cluster/_commonnn.py index 8d21d9a7..d86d2bc1 100644 --- a/sklearn_extra/cluster/_commonnn.py +++ b/sklearn_extra/cluster/_commonnn.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -"""Density-Based Common-Nearest-Neighbors Clustering -""" +"""Density-Based Common-Nearest-Neighbors Clustering""" # Author: Jan-Oliver Joswig # diff --git a/sklearn_extra/cluster/tests/test_commonnn.py b/sklearn_extra/cluster/tests/test_commonnn.py index 757878b4..46c3dbfc 100644 --- a/sklearn_extra/cluster/tests/test_commonnn.py +++ b/sklearn_extra/cluster/tests/test_commonnn.py @@ -1,5 +1,4 @@ -"""Tests for common-nearest neighbour clustering -""" +"""Tests for common-nearest neighbour clustering""" import pickle @@ -21,7 +20,6 @@ from sklearn.cluster.tests.common import generate_clustered_data from sklearn.metrics.pairwise import pairwise_distances - # TODO Tests where adapted from sklearn.cluster.tests.test_dbscan # of scikit-learn version 0.24.dev0. # To make sklearn_extra.cluster._commonnn compatible with diff --git a/sklearn_extra/cluster/tests/test_k_medoids.py b/sklearn_extra/cluster/tests/test_k_medoids.py index 30f419a0..44c153ac 100644 --- a/sklearn_extra/cluster/tests/test_k_medoids.py +++ b/sklearn_extra/cluster/tests/test_k_medoids.py @@ -1,4 +1,5 @@ """Testing for K-Medoids""" + import warnings import numpy as np from unittest import mock @@ -15,7 +16,6 @@ from sklearn.cluster import KMeans from sklearn.datasets import make_blobs - seed = 0 X = np.random.RandomState(seed).rand(100, 5) diff --git a/sklearn_extra/kernel_approximation/__init__.py b/sklearn_extra/kernel_approximation/__init__.py index 79f45d8f..1f39c1c3 100644 --- a/sklearn_extra/kernel_approximation/__init__.py +++ b/sklearn_extra/kernel_approximation/__init__.py @@ -1,4 +1,3 @@ from ._fastfood import Fastfood - __all__ = ["Fastfood"] diff --git a/sklearn_extra/kernel_approximation/test_fastfood.py b/sklearn_extra/kernel_approximation/test_fastfood.py index 8b9cc19c..2bde66f2 100644 --- a/sklearn_extra/kernel_approximation/test_fastfood.py +++ b/sklearn_extra/kernel_approximation/test_fastfood.py @@ -6,7 +6,6 @@ from sklearn_extra.kernel_approximation import Fastfood - # generate data rng = np.random.RandomState(0) X = rng.random_sample(size=(300, 50)) diff --git a/sklearn_extra/robust/robust_weighted_estimator.py b/sklearn_extra/robust/robust_weighted_estimator.py index bfe6bcb7..29761060 100644 --- a/sklearn_extra/robust/robust_weighted_estimator.py +++ b/sklearn_extra/robust/robust_weighted_estimator.py @@ -32,7 +32,6 @@ from .mean_estimators import median_of_means_blocked, block_mom, huber from ._robust_weighted_estimator_helper import _kmeans_loss - # cython implementation of loss functions, copied from scikit-learn with light # modifications. from ._robust_weighted_estimator_helper import ( @@ -45,7 +44,6 @@ SquaredHinge, ) - LOSS_FUNCTIONS = { "hinge": (Hinge,), "log_loss": (Log,), diff --git a/sklearn_extra/robust/tests/test_mean_estimators.py b/sklearn_extra/robust/tests/test_mean_estimators.py index 2f005662..cdea6aa8 100644 --- a/sklearn_extra/robust/tests/test_mean_estimators.py +++ b/sklearn_extra/robust/tests/test_mean_estimators.py @@ -3,7 +3,6 @@ from sklearn_extra.robust.mean_estimators import median_of_means, huber - rng = np.random.RandomState(42) sample = rng.normal(size=100) diff --git a/sklearn_extra/tests/test_common.py b/sklearn_extra/tests/test_common.py index 5b71ecf8..eb99de55 100644 --- a/sklearn_extra/tests/test_common.py +++ b/sklearn_extra/tests/test_common.py @@ -10,7 +10,6 @@ RobustWeightedKMeans, ) - ALL_ESTIMATORS = [ Fastfood, KMedoids,