Skip to content
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
2 changes: 1 addition & 1 deletion sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np

from . import __version__
from sklearn.utils import _IS_32BIT
from .utils import _IS_32BIT

_DEFAULT_TAGS = {
'non_deterministic': False,
Expand Down
2 changes: 1 addition & 1 deletion sklearn/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from scipy.special import expit
from scipy.special import xlogy
from scipy.optimize import fmin_bfgs
from sklearn.preprocessing import LabelEncoder
from .preprocessing import LabelEncoder

from .base import BaseEstimator, ClassifierMixin, RegressorMixin, clone
from .preprocessing import label_binarize, LabelBinarizer
Expand Down
2 changes: 1 addition & 1 deletion sklearn/cluster/_hierarchical.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ctypedef np.int8_t INT8

np.import_array()

from sklearn.utils.fast_dict cimport IntFloatDict
from ..utils.fast_dict cimport IntFloatDict

# C++
from cython.operator cimport dereference as deref, preincrement as inc
Expand Down
2 changes: 1 addition & 1 deletion sklearn/cluster/_k_means.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cimport numpy as np
cimport cython
from cython cimport floating

from sklearn.utils.sparsefuncs_fast import assign_rows_csr
from ..utils.sparsefuncs_fast import assign_rows_csr
from ..utils._cython_blas cimport _dot

ctypedef np.float64_t DOUBLE
Expand Down
2 changes: 1 addition & 1 deletion sklearn/cluster/affinity_propagation_.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np
import warnings

from sklearn.exceptions import ConvergenceWarning
from ..exceptions import ConvergenceWarning
from ..base import BaseEstimator, ClusterMixin
from ..utils import as_float_array, check_array
from ..utils.validation import check_is_fitted
Expand Down
2 changes: 1 addition & 1 deletion sklearn/datasets/openml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import numpy as np
import scipy.sparse

from sklearn.externals import _arff
from ..externals import _arff
from .base import get_data_home
from urllib.error import HTTPError
from ..utils import Bunch
Expand Down
4 changes: 2 additions & 2 deletions sklearn/datasets/species_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
from .base import _fetch_remote
from .base import RemoteFileMetadata
from ..utils import Bunch
from sklearn.datasets.base import _pkl_filepath
from sklearn.utils import _joblib
from .base import _pkl_filepath
from ..utils import _joblib

# The original data can be found at:
# https://biodiversityinformatics.amnh.org/open_source/maxent/samples.zip
Expand Down
2 changes: 1 addition & 1 deletion sklearn/datasets/svmlight_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def load_svmlight_file(f, n_features=None, dtype=np.float64,
To use joblib.Memory to cache the svmlight file::

from joblib import Memory
from sklearn.datasets import load_svmlight_file
from .datasets import load_svmlight_file
mem = Memory("./mycache")

@mem.cache
Expand Down
12 changes: 6 additions & 6 deletions sklearn/ensemble/_gradient_boosting.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ np.import_array()
from scipy.sparse import issparse
from scipy.sparse import csr_matrix

from sklearn.tree._tree cimport Node
from sklearn.tree._tree cimport Tree
from sklearn.tree._tree cimport DTYPE_t
from sklearn.tree._tree cimport SIZE_t
from sklearn.tree._tree cimport INT32_t
from sklearn.tree._utils cimport safe_realloc
from ..tree._tree cimport Node
from ..tree._tree cimport Tree
from ..tree._tree cimport DTYPE_t
from ..tree._tree cimport SIZE_t
from ..tree._tree cimport INT32_t
from ..tree._utils cimport safe_realloc

ctypedef np.int32_t int32
ctypedef np.float64_t float64
Expand Down
4 changes: 2 additions & 2 deletions sklearn/feature_extraction/_hashing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ from libc.stdlib cimport abs
cimport numpy as np
import numpy as np

from sklearn.utils.murmurhash cimport murmurhash3_bytes_s32
from sklearn.utils.fixes import sp_version
from ..utils.murmurhash cimport murmurhash3_bytes_s32
from ..utils.fixes import sp_version

np.import_array()

Expand Down
14 changes: 7 additions & 7 deletions sklearn/gaussian_process/gpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from scipy.optimize import fmin_l_bfgs_b
from scipy.special import erf, expit

from sklearn.base import BaseEstimator, ClassifierMixin, clone
from sklearn.gaussian_process.kernels \
from ..base import BaseEstimator, ClassifierMixin, clone
from .kernels \
import RBF, CompoundKernel, ConstantKernel as C
from sklearn.utils.validation import check_X_y, check_is_fitted, check_array
from sklearn.utils import check_random_state
from sklearn.preprocessing import LabelEncoder
from sklearn.multiclass import OneVsRestClassifier, OneVsOneClassifier
from sklearn.exceptions import ConvergenceWarning
from ..utils.validation import check_X_y, check_is_fitted, check_array
from ..utils import check_random_state
from ..preprocessing import LabelEncoder
from ..multiclass import OneVsRestClassifier, OneVsOneClassifier
from ..exceptions import ConvergenceWarning


# Values required for approximating the logistic sigmoid by
Expand Down
12 changes: 6 additions & 6 deletions sklearn/gaussian_process/gpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from scipy.linalg import cholesky, cho_solve, solve_triangular
from scipy.optimize import fmin_l_bfgs_b

from sklearn.base import BaseEstimator, RegressorMixin, clone
from sklearn.base import MultiOutputMixin
from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C
from sklearn.utils import check_random_state
from sklearn.utils.validation import check_X_y, check_array
from sklearn.exceptions import ConvergenceWarning
from ..base import BaseEstimator, RegressorMixin, clone
from ..base import MultiOutputMixin
from .kernels import RBF, ConstantKernel as C
from ..utils import check_random_state
from ..utils.validation import check_X_y, check_array
from ..exceptions import ConvergenceWarning


class GaussianProcessRegressor(BaseEstimator, RegressorMixin,
Expand Down
2 changes: 1 addition & 1 deletion sklearn/linear_model/cd_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ from ..utils._cython_blas cimport (_axpy, _dot, _asum, _ger, _gemv, _nrm2,
from ..utils._cython_blas cimport RowMajor, ColMajor, Trans, NoTrans


from sklearn.utils cimport _random
from ..utils cimport _random

ctypedef np.float64_t DOUBLE
ctypedef np.uint32_t UINT32_t
Expand Down
4 changes: 2 additions & 2 deletions sklearn/linear_model/sgd_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ from numpy.math cimport INFINITY
cdef extern from "sgd_fast_helpers.h":
bint skl_isfinite(double) nogil

from sklearn.utils.weight_vector cimport WeightVector
from sklearn.utils.seq_dataset cimport SequentialDataset64 as SequentialDataset
from ..utils.weight_vector cimport WeightVector
from ..utils.seq_dataset cimport SequentialDataset64 as SequentialDataset

np.import_array()

Expand Down
2 changes: 1 addition & 1 deletion sklearn/manifold/_barnes_hut_tsne.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from libc.math cimport sqrt, log
import numpy as np
cimport numpy as np

from sklearn.neighbors.quad_tree cimport _QuadTree
from ..neighbors.quad_tree cimport _QuadTree

cdef char* EMPTY_STRING = ""

Expand Down
1 change: 0 additions & 1 deletion sklearn/metrics/cluster/bicluster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import numpy as np
from scipy.optimize import linear_sum_assignment

Expand Down
2 changes: 1 addition & 1 deletion sklearn/metrics/cluster/expected_mutual_info_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from scipy.special import gammaln
import numpy as np
cimport numpy as np
cimport cython
from sklearn.utils.lgamma cimport lgamma
from ...utils.lgamma cimport lgamma

np.import_array()
ctypedef np.float64_t DOUBLE
Expand Down
2 changes: 1 addition & 1 deletion sklearn/metrics/cluster/unsupervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ..pairwise import pairwise_distances_chunked
from ..pairwise import pairwise_distances
from ...preprocessing import LabelEncoder
from sklearn.utils import deprecated
from ...utils import deprecated


def check_number_of_labels(n_labels, n_samples):
Expand Down
2 changes: 1 addition & 1 deletion sklearn/neighbors/binary_tree.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ cimport numpy as np
from libc.math cimport fabs, sqrt, exp, cos, pow, log
from libc.stdlib cimport calloc, malloc, free
from libc.string cimport memcpy
from sklearn.utils.lgamma cimport lgamma
from ..utils.lgamma cimport lgamma

import numpy as np
import warnings
Expand Down
2 changes: 1 addition & 1 deletion sklearn/neighbors/quad_tree.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from libc.stdlib cimport malloc, free
from libc.string cimport memcpy
from libc.stdio cimport printf

from sklearn.tree._utils cimport safe_realloc, sizet_ptr_to_ndarray
from ..tree._utils cimport safe_realloc, sizet_ptr_to_ndarray
from ..utils import check_array

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion sklearn/tree/_utils.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
cimport numpy as np
from ._tree cimport Node
from sklearn.neighbors.quad_tree cimport Cell
from ..neighbors.quad_tree cimport Cell

ctypedef np.npy_float32 DTYPE_t # Type of X
ctypedef np.npy_float64 DOUBLE_t # Type of y, sample_weight
Expand Down
2 changes: 1 addition & 1 deletion sklearn/tree/_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import numpy as np
cimport numpy as np
np.import_array()

from sklearn.utils cimport _random
from ..utils cimport _random

# =============================================================================
# Helper functions
Expand Down
2 changes: 1 addition & 1 deletion sklearn/utils/_random.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import numpy as np
cimport numpy as np
np.import_array()

from sklearn.utils import check_random_state
from . import check_random_state

cdef UINT32_t DEFAULT_SEED = 1

Expand Down
82 changes: 41 additions & 41 deletions sklearn/utils/estimator_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,51 @@
from scipy import sparse
from scipy.stats import rankdata

from sklearn.utils import IS_PYPY
from sklearn.utils import _joblib
from sklearn.utils.testing import assert_raises, _get_args
from sklearn.utils.testing import assert_raises_regex
from sklearn.utils.testing import assert_raise_message
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_allclose
from sklearn.utils.testing import assert_allclose_dense_sparse
from sklearn.utils.testing import assert_warns_message
from sklearn.utils.testing import set_random_state
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_greater_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing import ignore_warnings
from sklearn.utils.testing import assert_dict_equal
from sklearn.utils.testing import create_memmap_backed_data
from sklearn.utils import is_scalar_nan
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.linear_model import Ridge


from sklearn.base import (clone, ClusterMixin, is_classifier, is_regressor,
from . import IS_PYPY
from . import _joblib
from .testing import assert_raises, _get_args
from .testing import assert_raises_regex
from .testing import assert_raise_message
from .testing import assert_equal
from .testing import assert_not_equal
from .testing import assert_in
from .testing import assert_array_equal
from .testing import assert_array_almost_equal
from .testing import assert_allclose
from .testing import assert_allclose_dense_sparse
from .testing import assert_warns_message
from .testing import set_random_state
from .testing import assert_greater
from .testing import assert_greater_equal
from .testing import SkipTest
from .testing import ignore_warnings
from .testing import assert_dict_equal
from .testing import create_memmap_backed_data
from . import is_scalar_nan
from ..discriminant_analysis import LinearDiscriminantAnalysis
from ..linear_model import Ridge


from ..base import (clone, ClusterMixin, is_classifier, is_regressor,
_DEFAULT_TAGS, RegressorMixin, is_outlier_detector)

from sklearn.metrics import accuracy_score, adjusted_rand_score, f1_score

from sklearn.random_projection import BaseRandomProjection
from sklearn.feature_selection import SelectKBest
from sklearn.pipeline import make_pipeline
from sklearn.exceptions import DataConversionWarning
from sklearn.exceptions import SkipTestWarning
from sklearn.model_selection import train_test_split
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selection._validation import _safe_split
from sklearn.metrics.pairwise import (rbf_kernel, linear_kernel,
from ..metrics import accuracy_score, adjusted_rand_score, f1_score

from ..random_projection import BaseRandomProjection
from ..feature_selection import SelectKBest
from ..pipeline import make_pipeline
from ..exceptions import DataConversionWarning
from ..exceptions import SkipTestWarning
from ..model_selection import train_test_split
from ..model_selection import ShuffleSplit
from ..model_selection._validation import _safe_split
from ..metrics.pairwise import (rbf_kernel, linear_kernel,
pairwise_distances)

from sklearn.utils import shuffle
from sklearn.utils.validation import has_fit_parameter, _num_samples
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import load_iris, load_boston, make_blobs
from .import shuffle
from .validation import has_fit_parameter, _num_samples
from ..preprocessing import StandardScaler
from ..datasets import load_iris, load_boston, make_blobs


BOSTON = None
Expand Down
2 changes: 1 addition & 1 deletion sklearn/utils/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import scipy.sparse as sp
import array

from sklearn.utils import check_random_state
from . import check_random_state
from ._random import sample_without_replacement

__all__ = ['sample_without_replacement']
Expand Down
2 changes: 1 addition & 1 deletion sklearn/utils/seq_dataset.pyx.tp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import numpy as np

np.import_array()

from sklearn.utils cimport _random
from . cimport _random

cdef class SequentialDataset{{name}}:
"""Base class for datasets with sequential data access.
Expand Down
2 changes: 1 addition & 1 deletion sklearn/utils/stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from sklearn.utils.extmath import stable_cumsum
from .extmath import stable_cumsum


def _weighted_percentile(array, sample_weight, percentile=50):
Expand Down