Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
1 change: 1 addition & 0 deletions examples/cluster/plot_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
parameterized, detects the outliers as a class of
their own.
"""

print(__doc__)

import time
Expand Down
1 change: 0 additions & 1 deletion examples/cluster/plot_commonnn_data_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from sklearn import datasets
from sklearn.preprocessing import StandardScaler


print(__doc__)


Expand Down
1 change: 1 addition & 0 deletions examples/cluster/plot_kmedoids_digits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions examples/eigenpro/plot_eigenpro_synthetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
the number of features exceeds 500, it begins to outperform
SVM and shows more stability.
"""

print(__doc__)

import matplotlib
Expand Down
1 change: 1 addition & 0 deletions examples/kernel_approximation/plot_kernel_approximation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
in :ref:`kernel_approximation`.

"""

print(__doc__)

# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
Expand Down
1 change: 1 addition & 0 deletions examples/plot_clara_digits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_commonnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<commonnn>`.

"""

import matplotlib.pyplot as plt
import numpy as np

Expand All @@ -18,7 +19,6 @@
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler


print(__doc__)

# #############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_kmedoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

# #############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_robust_classification_toy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
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
from sklearn.linear_model import SGDClassifier
from sklearn.datasets import make_blobs
from sklearn.utils import shuffle


rng = np.random.RandomState(42)

# Sample two Gaussian blobs
Expand Down
1 change: 1 addition & 0 deletions examples/plot_robust_regression_toy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions examples/robust/plot_robust_classification_diabete.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions sklearn_extra/cluster/_commonnn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
"""Density-Based Common-Nearest-Neighbors Clustering
"""
"""Density-Based Common-Nearest-Neighbors Clustering"""

# Author: Jan-Oliver Joswig <jan.joswig@fu-berlin.de>
#
Expand Down
4 changes: 1 addition & 3 deletions sklearn_extra/cluster/tests/test_commonnn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for common-nearest neighbour clustering
"""
"""Tests for common-nearest neighbour clustering"""

import pickle

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sklearn_extra/cluster/tests/test_k_medoids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Testing for K-Medoids"""

import warnings
import numpy as np
from unittest import mock
Expand All @@ -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)

Expand Down
1 change: 0 additions & 1 deletion sklearn_extra/kernel_approximation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from ._fastfood import Fastfood


__all__ = ["Fastfood"]
1 change: 0 additions & 1 deletion sklearn_extra/kernel_approximation/test_fastfood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 0 additions & 2 deletions sklearn_extra/robust/robust_weighted_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -45,7 +44,6 @@
SquaredHinge,
)


LOSS_FUNCTIONS = {
"hinge": (Hinge,),
"log_loss": (Log,),
Expand Down
1 change: 0 additions & 1 deletion sklearn_extra/robust/tests/test_mean_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion sklearn_extra/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
RobustWeightedKMeans,
)


ALL_ESTIMATORS = [
Fastfood,
KMedoids,
Expand Down
Loading