Skip to content

[MRG] Fix imports in pip3 ubuntu by suffixing affected files #15891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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 sklearn/_build_utils/deprecated_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
'SpectralBiclustering'),
('_birch', 'sklearn.cluster.birch', 'sklearn.cluster', 'Birch'),
('_dbscan', 'sklearn.cluster.dbscan_', 'sklearn.cluster', 'DBSCAN'),
('_hierarchical', 'sklearn.cluster.hierarchical', 'sklearn.cluster',
('_agglomerative', 'sklearn.cluster.hierarchical', 'sklearn.cluster',
'FeatureAgglomeration'),
('_k_means', 'sklearn.cluster.k_means_', 'sklearn.cluster', 'KMeans'),
('_kmeans', 'sklearn.cluster.k_means_', 'sklearn.cluster', 'KMeans'),
('_mean_shift', 'sklearn.cluster.mean_shift_', 'sklearn.cluster',
'MeanShift'),
('_optics', 'sklearn.cluster.optics_', 'sklearn.cluster', 'OPTICS'),
Expand Down Expand Up @@ -101,7 +101,7 @@
('_kernel_pca', 'sklearn.decomposition.kernel_pca',
'sklearn.decomposition', 'KernelPCA'),
('_nmf', 'sklearn.decomposition.nmf', 'sklearn.decomposition', 'NMF'),
('_online_lda', 'sklearn.decomposition.online_lda',
('_lda', 'sklearn.decomposition.online_lda',
'sklearn.decomposition', 'LatentDirichletAllocation'),
('_online_lda_fast', 'sklearn.decomposition.online_lda_fast',
'sklearn.decomposition', 'mean_change'),
Expand Down Expand Up @@ -140,7 +140,7 @@

('_dict_vectorizer', 'sklearn.feature_extraction.dict_vectorizer',
'sklearn.feature_extraction', 'DictVectorizer'),
('_hashing', 'sklearn.feature_extraction.hashing',
('_hash', 'sklearn.feature_extraction.hashing',
'sklearn.feature_extraction', 'FeatureHasher'),
('_stop_words', 'sklearn.feature_extraction.stop_words',
'sklearn.feature_extraction.text', 'ENGLISH_STOP_WORDS'),
Expand Down
6 changes: 3 additions & 3 deletions sklearn/cluster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from ._mean_shift import (mean_shift, MeanShift,
estimate_bandwidth, get_bin_seeds)
from ._affinity_propagation import affinity_propagation, AffinityPropagation
from ._hierarchical import (ward_tree, AgglomerativeClustering, linkage_tree,
FeatureAgglomeration)
from ._k_means import k_means, KMeans, MiniBatchKMeans
from ._agglomerative import (ward_tree, AgglomerativeClustering,
linkage_tree, FeatureAgglomeration)
from ._kmeans import k_means, KMeans, MiniBatchKMeans
from ._dbscan import dbscan, DBSCAN
from ._optics import (OPTICS, cluster_optics_dbscan, compute_optics_graph,
cluster_optics_xi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from ._feature_agglomeration import AgglomerationTransform
from ..utils._fast_dict import IntFloatDict
from ..utils.fixes import _astype_copy_false
from ..utils import deprecated


###############################################################################
# For non fully-connected graphs
Expand Down Expand Up @@ -249,8 +249,8 @@ def ward_tree(X, connectivity=None, n_clusters=None, return_distance=False):
else:
if n_clusters > n_samples:
raise ValueError('Cannot provide more clusters than samples. '
'%i n_clusters was asked, and there are %i samples.'
% (n_clusters, n_samples))
'%i n_clusters was asked, and there are %i '
'samples.' % (n_clusters, n_samples))
n_nodes = 2 * n_samples - n_clusters

# create inertia matrix
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sklearn/cluster/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..metrics.pairwise import pairwise_kernels
from ..neighbors import kneighbors_graph, NearestNeighbors
from ..manifold import spectral_embedding
from ._k_means import k_means
from ._kmeans import k_means


def discretize(vectors, copy=True, max_svd_restarts=30, n_iter_max=20,
Expand Down
5 changes: 3 additions & 2 deletions sklearn/cluster/tests/test_hierarchical.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

from sklearn.cluster import ward_tree
from sklearn.cluster import AgglomerativeClustering, FeatureAgglomeration
from sklearn.cluster._hierarchical import (_hc_cut, _TREE_BUILDERS,
linkage_tree, _fix_connectivity)
from sklearn.cluster._agglomerative import (_hc_cut, _TREE_BUILDERS,
linkage_tree,
_fix_connectivity)
from sklearn.feature_extraction.image import grid_to_graph
from sklearn.metrics.pairwise import PAIRED_DISTANCES, cosine_distances,\
manhattan_distances, pairwise_distances
Expand Down
8 changes: 4 additions & 4 deletions sklearn/cluster/tests/test_k_means.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from sklearn.metrics.cluster import v_measure_score
from sklearn.cluster import KMeans, k_means
from sklearn.cluster import MiniBatchKMeans
from sklearn.cluster._k_means import _labels_inertia
from sklearn.cluster._k_means import _mini_batch_step
from sklearn.cluster._kmeans import _labels_inertia
from sklearn.cluster._kmeans import _mini_batch_step
from sklearn.datasets import make_blobs
from io import StringIO
from sklearn.metrics.cluster import homogeneity_score
Expand Down Expand Up @@ -734,7 +734,7 @@ def test_k_means_function():

def test_x_squared_norms_init_centroids():
# Test that x_squared_norms can be None in _init_centroids
from sklearn.cluster._k_means import _init_centroids
from sklearn.cluster._kmeans import _init_centroids

X_norms = np.sum(X**2, axis=1)
precompute = _init_centroids(
Expand Down Expand Up @@ -921,7 +921,7 @@ def test_sample_weight_length():


def test_check_normalize_sample_weight():
from sklearn.cluster._k_means import _check_normalize_sample_weight
from sklearn.cluster._kmeans import _check_normalize_sample_weight
sample_weight = None
checked_sample_weight = _check_normalize_sample_weight(sample_weight, X)
assert _num_samples(X) == _num_samples(checked_sample_weight)
Expand Down
2 changes: 1 addition & 1 deletion sklearn/decomposition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
MiniBatchDictionaryLearning, SparseCoder)
from ._factor_analysis import FactorAnalysis
from ..utils.extmath import randomized_svd
from ._online_lda import LatentDirichletAllocation
from ._lda import LatentDirichletAllocation

__all__ = ['DictionaryLearning',
'FastICA',
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions sklearn/decomposition/tests/test_online_lda.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import pytest

from sklearn.decomposition import LatentDirichletAllocation
from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d,
_dirichlet_expectation_2d)
from sklearn.decomposition._lda import (_dirichlet_expectation_1d,
_dirichlet_expectation_2d)

from sklearn.utils._testing import assert_allclose
from sklearn.utils._testing import assert_array_almost_equal
Expand Down
2 changes: 1 addition & 1 deletion sklearn/feature_extraction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from ._dict_vectorizer import DictVectorizer
from ._hashing import FeatureHasher
from ._hash import FeatureHasher
from .image import img_to_graph, grid_to_graph
from . import text

Expand Down
2 changes: 1 addition & 1 deletion sklearn/feature_extraction/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from ..base import BaseEstimator, TransformerMixin
from ..preprocessing import normalize
from ._hashing import FeatureHasher
from ._hash import FeatureHasher
from ._stop_words import ENGLISH_STOP_WORDS
from ..utils.validation import check_is_fitted, check_array, FLOAT_DTYPES
from ..utils import _IS_32BIT, deprecated
Expand Down