Module Expr Str ImportFrom alias Import alias identifier ImportFrom alias Import alias ImportFrom alias alias alias alias alias alias alias alias alias alias ImportFrom alias alias ImportFrom alias Assign NameStore ListLoad Str Str Str Str Str Str Str Str Str Str Str Str Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults Str body Expr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call NameLoad NameLoad NameLoad body Return Call AttributeLoad NameLoad attr NameLoad orelse Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore BinOpMod Str AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body AugAssignAdd NameStore BinOpMod Str AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args defaults vararg kwarg body Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return Call NameLoad NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpMod Str AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body AugAssignAdd NameStore BinOpMod Str AttributeLoad NameLoad attr FunctionDef arguments args defaults vararg kwarg body Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return Call NameLoad NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Str If AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr If NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Return NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return NameLoad If Call NameLoad NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad Str body Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad orelse If Call NameLoad NameLoad Str body If BoolOpAnd Call NameLoad NameLoad Str BoolOpAnd Call NameLoad NameLoad Str CompareEq AttributeLoad AttributeLoad NameLoad attr attr Str body Return Call AttributeLoad NameLoad attr NameLoad keyword Num orelse Return SubscriptLoad NameLoad Index NameLoad orelse Return ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad decorator_list FunctionDef arguments args defaults vararg kwarg body Expr Str Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If NameLoad body Raise Call NameLoad BinOpMod Str Call AttributeLoad NameLoad attr If CompareEq Call NameLoad NameLoad Num body Return NameLoad Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore IfExp Call NameLoad NameLoad Str SubscriptLoad AttributeLoad NameLoad attr Index Num Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore NameLoad If CompareGt NameLoad NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Expr Call NameLoad NameLoad Assign NameStore ListComp Call NameLoad NameLoad keyword Str keyword NameLoad keyword NameLoad comprehension NameStore NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num NameLoad keyword TupleLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareEq Call NameLoad NameLoad Num body Return SubscriptLoad NameLoad Index Num orelse Return NameLoad decorator_list FunctionDef arguments args defaults vararg kwarg body Expr Str Assign SubscriptStore NameLoad Index Str NameLoad Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad keyword ListLoad Str Str Str If Call NameLoad NameLoad body If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AugAssignPow AttributeStore NameLoad attr Num orelse If NameLoad body Assign NameStore BinOpPow NameLoad Num orelse AugAssignPow NameStore Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Num For NameStore Call NameLoad Call NameLoad BinOpFloorDiv NameLoad NameLoad body Assign NameStore BinOpAdd NameLoad NameLoad Expr Yield Call NameLoad NameLoad NameLoad Assign NameStore NameLoad If CompareLt NameLoad NameLoad body Expr Yield Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Num For NameStore Call NameLoad NameLoad body Assign NameStore BinOpFloorDiv NameLoad NameLoad If CompareLt NameLoad BinOpMod NameLoad NameLoad body AugAssignAdd NameStore Num If CompareGt NameLoad Num body Assign NameStore BinOpAdd NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Expr Yield Call NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareLt NameLoad Num body Return Call NameLoad BinOpAdd BinOpAdd Call NameLoad Num NameLoad Num orelse If CompareEq NameLoad Num body Raise Call NameLoad Str orelse Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad Assign NameStore BinOpMult BinOpFloorDiv NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr AugAssignAdd SubscriptStore NameLoad Slice BinOpMod NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return TupleLoad NameLoad Call AttributeLoad NameLoad attr BinOpAdd ListLoad Num Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad orelse If Call NameLoad NameLoad NameLoad body Return NameLoad orelse Return Call NameLoad NameLoad decorator_list ClassDef bases NameLoad body Expr Str decorator_list ClassDef bases NameLoad body Expr Str decorator_list
N/A N/A 
The :mod:`sklearn.utils` module includes various utilities.
 collections Sequence N/A numpy np scipy.sparse issparse N/A warnings validation as_float_array assert_all_finite warn_if_not_float check_random_state column_or_1d check_array check_consistent_length check_X_y indexable check_symmetric class_weight compute_class_weight compute_sample_weight sklearn.externals.joblib cpu_count N/A __all__ N/A as_float_array assert_all_finite check_array warn_if_not_float check_random_state compute_class_weight compute_sample_weight column_or_1d safe_indexing check_consistent_length check_X_y indexable check_symmetric deprecated N/A object N/A N/A Decorator to mark a function or class as deprecated.

    Issue a warning when the function is called/the class is instantiated and
    adds a warning to the docstring.

    The optional extra argument will be appended to the deprecation message
    and the docstring. Note: to use this with the default value for extra, put
    in an empty of parentheses:

    >>> from sklearn.utils import deprecated
    >>> deprecated() # doctest: +ELLIPSIS
    <sklearn.utils.deprecated object at ...>

    >>> @deprecated()
    ... def some_function(): pass
     __init__ N/A N/A self extra N/A N/A N/A 
        Parameters
        ----------
        extra: string
          to be added to the deprecation messages

         N/A N/A self extra extra N/A __call__ N/A N/A self obj N/A N/A N/A N/A isinstance obj type N/A N/A N/A N/A self _decorate_class obj N/A N/A N/A N/A self _decorate_fun obj N/A _decorate_class N/A N/A self cls N/A N/A N/A msg N/A Class %s is deprecated N/A cls __name__ N/A N/A self extra N/A N/A msg N/A ; %s N/A self extra N/A init N/A cls __init__ wrapped N/A N/A N/A args kwargs N/A N/A N/A N/A warnings warn msg category DeprecationWarning N/A N/A init args kwargs N/A N/A N/A cls __init__ wrapped N/A N/A wrapped __name__ __init__ N/A N/A wrapped __doc__ N/A N/A self _update_doc N/A init __doc__ N/A N/A wrapped deprecated_original init N/A cls N/A _decorate_fun N/A N/A self fun N/A N/A N/A Decorate function fun N/A msg N/A Function %s is deprecated N/A fun __name__ N/A N/A self extra N/A N/A msg N/A ; %s N/A self extra wrapped N/A N/A N/A args kwargs N/A N/A N/A N/A warnings warn msg category DeprecationWarning N/A N/A fun args kwargs N/A N/A N/A wrapped __name__ N/A fun __name__ N/A N/A wrapped __dict__ N/A fun __dict__ N/A N/A wrapped __doc__ N/A N/A self _update_doc N/A fun __doc__ N/A wrapped N/A _update_doc N/A N/A self olddoc N/A N/A N/A newdoc DEPRECATED N/A N/A self extra N/A N/A newdoc N/A %s: %s N/A newdoc N/A self extra N/A olddoc N/A N/A newdoc N/A %s

%s N/A newdoc olddoc N/A newdoc N/A N/A safe_mask N/A N/A X mask N/A N/A N/A Return a mask which is safe to use on X.

    Parameters
    ----------
    X : {array-like, sparse matrix}
        Data on which to apply mask.

    mask: array
        Mask to be used on X.

    Returns
    -------
        mask
     N/A mask N/A N/A np asarray mask N/A N/A N/A np issubdtype N/A mask dtype N/A np int N/A N/A mask N/A N/A hasattr X toarray N/A N/A ind N/A N/A np arange N/A N/A mask shape N/A 0 N/A mask N/A ind N/A mask N/A mask N/A safe_indexing N/A N/A X indices N/A N/A N/A Return items or rows from X using indices.

    Allows simple indexing of lists or arrays.

    Parameters
    ----------
    X : array-like, sparse-matrix, list.
        Data from which to sample rows or items.

    indices : array-like, list
        Indices according to which X will be subsampled.
     N/A N/A hasattr X iloc N/A N/A N/A N/A X iloc N/A indices N/A N/A N/A hasattr X shape N/A N/A N/A N/A hasattr X take N/A N/A hasattr indices dtype N/A N/A N/A indices dtype kind i N/A N/A N/A N/A X take indices axis 0 N/A N/A N/A X N/A indices N/A N/A N/A N/A X N/A idx N/A idx indices N/A resample N/A N/A N/A arrays options N/A N/A Resample arrays or sparse matrices in a consistent way

    The default strategy implements one step of the bootstrapping
    procedure.

    Parameters
    ----------
    *arrays : sequence of arrays or scipy.sparse matrices with same shape[0]

    replace : boolean, True by default
        Implements resampling with replacement. If False, this will implement
        (sliced) random permutations.

    n_samples : int, None by default
        Number of samples to generate. If left to None this is
        automatically set to the first dimension of the arrays.

    random_state : int or RandomState instance
        Control the shuffling for reproducible behavior.

    Returns
    -------
    resampled_arrays : sequence of arrays or scipy.sparse matrices with same     shape[0]
        Sequence of resampled views of the collections. The original arrays are 
        not impacted.

    Examples
    --------
    It is possible to mix sparse and dense arrays in the same run::

      >>> X = [[1., 0.], [2., 1.], [0., 0.]]
      >>> y = np.array([0, 1, 2])

      >>> from scipy.sparse import coo_matrix
      >>> X_sparse = coo_matrix(X)

      >>> from sklearn.utils import resample
      >>> X, X_sparse, y = resample(X, X_sparse, y, random_state=0)
      >>> X
      array([[ 1.,  0.],
             [ 2.,  1.],
             [ 1.,  0.]])

      >>> X_sparse                   # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      <3x2 sparse matrix of type '<... 'numpy.float64'>'
          with 4 stored elements in Compressed Sparse Row format>

      >>> X_sparse.toarray()
      array([[ 1.,  0.],
             [ 2.,  1.],
             [ 1.,  0.]])

      >>> y
      array([0, 1, 0])

      >>> resample(y, n_samples=2, random_state=0)
      array([0, 1])


    See also
    --------
    :class:`sklearn.cross_validation.Bootstrap`
    :func:`sklearn.utils.shuffle`
     N/A random_state N/A check_random_state N/A N/A options pop random_state None N/A replace N/A N/A options pop replace True N/A max_n_samples N/A N/A options pop n_samples None N/A options N/A N/A N/A ValueError N/A Unexpected kw arguments: %r N/A N/A options keys N/A N/A N/A len arrays 0 N/A N/A None N/A first N/A arrays N/A 0 N/A n_samples N/A N/A hasattr first shape N/A N/A first shape N/A 0 N/A len first N/A N/A max_n_samples None N/A N/A max_n_samples n_samples N/A N/A max_n_samples n_samples N/A N/A N/A ValueError N/A Cannot sample %d out of arrays with dim %d N/A max_n_samples n_samples N/A N/A check_consistent_length arrays N/A arrays N/A N/A check_array x accept_sparse csr ensure_2d False allow_nd True N/A x arrays N/A replace N/A N/A indices N/A N/A random_state randint 0 n_samples size N/A max_n_samples N/A N/A indices N/A N/A np arange n_samples N/A N/A N/A random_state shuffle indices N/A indices N/A indices N/A max_n_samples N/A resampled_arrays N/A N/A array arrays N/A N/A array N/A array N/A indices N/A N/A N/A resampled_arrays append array N/A N/A N/A len resampled_arrays 1 N/A N/A N/A resampled_arrays N/A 0 N/A N/A resampled_arrays N/A shuffle N/A N/A N/A arrays options N/A N/A Shuffle arrays or sparse matrices in a consistent way

    This is a convenience alias to ``resample(*arrays, replace=False)`` to do
    random permutations of the collections.

    Parameters
    ----------
    *arrays : sequence of arrays or scipy.sparse matrices with same shape[0]

    random_state : int or RandomState instance
        Control the shuffling for reproducible behavior.

    n_samples : int, None by default
        Number of samples to generate. If left to None this is
        automatically set to the first dimension of the arrays.

    Returns
    -------
    shuffled_arrays : sequence of arrays or scipy.sparse matrices with same     shape[0]
        Sequence of shuffled views of the collections. The original arrays are
        not impacted.

    Examples
    --------
    It is possible to mix sparse and dense arrays in the same run::

      >>> X = [[1., 0.], [2., 1.], [0., 0.]]
      >>> y = np.array([0, 1, 2])

      >>> from scipy.sparse import coo_matrix
      >>> X_sparse = coo_matrix(X)

      >>> from sklearn.utils import shuffle
      >>> X, X_sparse, y = shuffle(X, X_sparse, y, random_state=0)
      >>> X
      array([[ 0.,  0.],
             [ 2.,  1.],
             [ 1.,  0.]])

      >>> X_sparse                   # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      <3x2 sparse matrix of type '<... 'numpy.float64'>'
          with 3 stored elements in Compressed Sparse Row format>

      >>> X_sparse.toarray()
      array([[ 0.,  0.],
             [ 2.,  1.],
             [ 1.,  0.]])

      >>> y
      array([2, 1, 0])

      >>> shuffle(y, n_samples=2, random_state=0)
      array([0, 1])

    See also
    --------
    :func:`sklearn.utils.resample`
     N/A N/A options N/A replace False N/A N/A resample arrays options N/A safe_sqr N/A N/A X copy N/A True N/A N/A Element wise squaring of array-likes and sparse matrices.

    Parameters
    ----------
    X : array like, matrix, sparse matrix

    copy : boolean, optional, default True
        Whether to create a copy of X and operate on it or to perform
        inplace computation (default behaviour).

    Returns
    -------
    X ** 2 : element wise square
     N/A X N/A check_array X accept_sparse N/A csr csc coo N/A N/A issparse X N/A N/A copy N/A N/A X N/A N/A X copy N/A N/A X data 2 N/A N/A copy N/A N/A X N/A X 2 N/A N/A X 2 N/A X N/A gen_batches N/A N/A n batch_size N/A N/A N/A Generator to create slices containing batch_size elements, from 0 to n.

    The last slice may contain less than batch_size elements, when batch_size
    does not divide n.

    Examples
    --------
    >>> from sklearn.utils import gen_batches
    >>> list(gen_batches(7, 3))
    [slice(0, 3, None), slice(3, 6, None), slice(6, 7, None)]
    >>> list(gen_batches(6, 3))
    [slice(0, 3, None), slice(3, 6, None)]
    >>> list(gen_batches(2, 3))
    [slice(0, 2, None)]
     N/A start 0 N/A _ N/A range N/A int N/A n batch_size N/A N/A end N/A start batch_size N/A N/A N/A slice start end N/A start end N/A N/A start n N/A N/A N/A N/A slice start n N/A gen_even_slices N/A N/A n n_packs n_samples N/A None N/A N/A Generator to create n_packs slices going up to n.

    Pass n_samples when the slices are to be used for sparse matrix indexing;
    slicing off-the-end raises an exception, while it works for NumPy arrays.

    Examples
    --------
    >>> from sklearn.utils import gen_even_slices
    >>> list(gen_even_slices(10, 1))
    [slice(0, 10, None)]
    >>> list(gen_even_slices(10, 10))                     #doctest: +ELLIPSIS
    [slice(0, 1, None), slice(1, 2, None), ..., slice(9, 10, None)]
    >>> list(gen_even_slices(10, 5))                      #doctest: +ELLIPSIS
    [slice(0, 2, None), slice(2, 4, None), ..., slice(8, 10, None)]
    >>> list(gen_even_slices(10, 3))
    [slice(0, 4, None), slice(4, 7, None), slice(7, 10, None)]
     N/A start 0 N/A pack_num N/A range n_packs N/A N/A this_n N/A n n_packs N/A N/A pack_num N/A n n_packs N/A N/A this_n 1 N/A N/A this_n 0 N/A N/A end N/A start this_n N/A N/A n_samples None N/A N/A end N/A min n_samples end N/A N/A N/A slice start end None N/A start end N/A _get_n_jobs N/A N/A n_jobs N/A N/A N/A Get number of jobs for the computation.

    This function reimplements the logic of joblib to determine the actual
    number of jobs depending on the cpu count. If -1 all CPUs are used.
    If 1 is given, no parallel computing code is used at all, which is useful
    for debugging. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used.
    Thus for n_jobs = -2, all CPUs but one are used.

    Parameters
    ----------
    n_jobs : int
        Number of jobs stated in joblib convention.

    Returns
    -------
    n_jobs : int
        The actual number of jobs as positive integer.

    Examples
    --------
    >>> from sklearn.utils import _get_n_jobs
    >>> _get_n_jobs(4)
    4
    >>> jobs = _get_n_jobs(-2)
    >>> assert jobs == max(cpu_count() - 1, 1)
    >>> _get_n_jobs(0)
    Traceback (most recent call last):
    ...
    ValueError: Parameter n_jobs == 0 has no meaning.
     N/A N/A n_jobs 0 N/A N/A N/A max N/A N/A N/A cpu_count 1 n_jobs 1 N/A N/A N/A n_jobs 0 N/A N/A N/A ValueError Parameter n_jobs == 0 has no meaning. N/A N/A n_jobs N/A _partition_estimators N/A N/A n_estimators n_jobs N/A N/A N/A Private function used to partition estimators between jobs. N/A n_jobs N/A min N/A _get_n_jobs n_jobs n_estimators N/A n_estimators_per_job N/A N/A n_estimators n_jobs N/A N/A np ones n_jobs dtype N/A np int N/A N/A n_estimators_per_job N/A N/A n_estimators n_jobs 1 N/A starts N/A N/A np cumsum n_estimators_per_job N/A N/A n_jobs N/A N/A n_estimators_per_job tolist N/A N/A 0 N/A N/A starts tolist N/A tosequence N/A N/A x N/A N/A N/A Cast iterable x to a Sequence, avoiding a copy if possible. N/A N/A isinstance x N/A np ndarray N/A N/A N/A N/A np asarray x N/A N/A N/A isinstance x Sequence N/A N/A x N/A N/A N/A list x N/A ConvergenceWarning N/A UserWarning N/A N/A Custom warning to capture convergence problems N/A DataDimensionalityWarning N/A UserWarning N/A N/A Custom warning to notify potential issues with data dimensionality N/A