8000 fix order of mixin and BaseEstimator · scikit-learn/scikit-learn@8eab08a · GitHub
[go: up one dir, main page]

Skip to content

Commit 8eab08a

Browse files
committed
fix order of mixin and BaseEstimator
1 parent 4f822cc commit 8eab08a

File tree

90 files changed

+148
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+148
-148
lines changed

doc/developers/contributing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ If, for some reason, randomness is needed after ``fit``,
874874
the RNG should be stored in an attribute ``random_state_``.
875875
The following example should make this clear::
876876

877-
class GaussianNoise(BaseEstimator, TransformerMixin):
877+
class GaussianNoise(TransformerMixin, BaseEstimator):
878878
"""This estimator ignores its input and returns random Gaussian noise.
879879

880880
It also does not adhere to all scikit-learn conventions,
@@ -1361,7 +1361,7 @@ the correct interface more easily.
13611361
>>> from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
13621362
>>> from sklearn.utils.multiclass import unique_labels
13631363
>>> from sklearn.metrics import euclidean_distances
1364-
>>> class TemplateClassifier(BaseEstimator, ClassifierMixin):
1364+
>>> class TemplateClassifier(ClassifierMixin, BaseEstimator):
13651365
...
13661366
... def __init__(self, demo_param='demo'):
13671367
... self.demo_param = demo_param

examples/compose/plot_column_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
from sklearn.svm import LinearSVC
4343

4444

45-
class TextStats(BaseEstimator, TransformerMixin):
45+
class TextStats(TransformerMixin, BaseEstimator):
4646
"""Extract features from each document for DictVectorizer"""
4747

4848
def fit(self, x, y=None):
@@ -54,7 +54,7 @@ def transform(self, posts):
5454
for text in posts]
5555

5656

57-
class SubjectBodyExtractor(BaseEstimator, TransformerMixin):
57+
class SubjectBodyExtractor(TransformerMixin, BaseEstimator):
5858
"""Extract the subject & body from a usenet post in a single pass.
5959
6060
Takes a sequence of strings and produces a dict of sequences. Keys are

sklearn/calibration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def grad(AB):
465465
return AB_[0], AB_[1]
466466

467467

468-
class _SigmoidCalibration(BaseEstimator, RegressorMixin):
468+
class _SigmoidCalibration(RegressorMixin, BaseEstimator):
469469
"""Sigmoid regression model.
470470
471471
Attributes

sklearn/cluster/affinity_propagation_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def affinity_propagation(S, preference=None, convergence_iter=15, max_iter=200,
233233

234234
###############################################################################
235235

236-
class AffinityPropagation(BaseEstimator, ClusterMixin):
236+
class AffinityPropagation(ClusterMixin, BaseEstimator):
237237
"""Perform Affinity Propagation Clustering of data.
238238
239239
Read more in the :ref:`User Guide <affinity_propagation>`.

sklearn/cluster/bicluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _log_normalize(X):
8484
return L - row_avg - col_avg + avg
8585

8686

87-
class BaseSpectral(BaseEstimator, BiclusterMixin, metaclass=ABCMeta):
87+
class BaseSpectral(BiclusterMixin, BaseEstimator, metaclass=ABCMeta):
8888
"""Base class for spectral biclustering."""
8989

9090
@abstractmethod

sklearn/cluster/birch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def radius(self):
319319
self.sq_norm_)
320320

321321

322-
class Birch(BaseEstimator, TransformerMixin, ClusterMixin):
322+
class Birch(ClusterMixin, TransformerMixin, BaseEstimator):
323323
"""Implements the Birch clustering algorithm.
324324
325325
It is a memory-efficient, online-learning algorithm provided as an

sklearn/cluster/dbscan_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def dbscan(X, eps=0.5, min_samples=5, metric='minkowski', metric_params=None,
190190
return np.where(core_samples)[0], labels
191191

192192

193-
class DBSCAN(BaseEstimator, ClusterMixin):
193+
class DBSCAN(ClusterMixin, BaseEstimator):
194194
"""Perform DBSCAN clustering from vector array or distance matrix.
195195
196196
DBSCAN - Density-Based Spatial Clustering of Applications with Noise.

sklearn/cluster/hierarchical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def _hc_cut(n_clusters, children, n_leaves):
652652

653653
###############################################################################
654654

655-
class AgglomerativeClustering(BaseEstimator, ClusterMixin):
655+
class AgglomerativeClustering(ClusterMixin, BaseEstimator):
656656
"""
657657
Agglomerative Clustering
658658

sklearn/cluster/k_means_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ def _init_centroids(X, k, init, random_state=None, x_squared_norms=None,
760760
return centers
761761

762762

763-
class KMeans(BaseEstimator, ClusterMixin, TransformerMixin):
763+
class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):
764764
"""K-Means clustering
765765
766766
Read more in the :ref:`User Guide <k_means>`.

sklearn/cluster/mean_shift_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def get_bin_seeds(X, bin_size, min_bin_freq=1):
293293
return bin_seeds
294294

295295

296-
class MeanShift(BaseEstimator, ClusterMixin):
296+
class MeanShift(ClusterMixin, BaseEstimator):
297297
"""Mean shift clustering using a flat kernel.
298298
299299
Mean shift clustering aims to discover "blobs" in a smooth density of

0 commit comments

Comments
 (0)
0