Module ImportFrom alias Import alias identifier Import alias identifier Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad If CompareEq AttributeLoad NameLoad attr Num body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Raise Call NameLoad Str If CompareLtE NameLoad Num body Raise Call NameLoad Str orelse If CompareNotEq AttributeLoad NameLoad attr Num body Raise Call NameLoad Str orelse Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num If CompareIs NameLoad Num body Raise Call NameLoad Str If CompareNotEq NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr keyword Num keyword NameLoad If CompareNotEq AttributeLoad NameLoad attr Num body Raise Call NameLoad Str If CompareNotEq AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If Call AttributeLoad NameLoad attr CompareLt NameLoad Num body Raise Call NameLoad Str If UnaryOpNot Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num body Raise Call NameLoad Str Assign NameStore NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr orelse Assign NameStore Num If NameLoad body If CompareNotEq NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AugAssignDiv NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Num NameLoad keyword NameLoad orelse If CompareGt NameLoad NameLoad body Raise Call NameLoad Str If CompareNotEq NameLoad NameLoad body If CompareLt Call AttributeLoad NameLoad attr CompareGt NameLoad Num NameLoad body Raise Call NameLoad Str Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr While CompareLt NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad If CompareGt NameLoad Num body Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Slice Num NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignDiv NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Slice NameLoad BinOpAdd NameLoad AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore AttributeLoad NameLoad attr Assign NameStore NameLoad orelse Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Slice NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If BoolOpAnd CompareIs NameLoad NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Num If CompareEq AttributeLoad NameLoad attr Num body Return NameLoad If BoolOpAnd CompareIsNot NameLoad NameLoad CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr TupleLoad keyword AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index TupleLoad SubscriptLoad NameLoad Index NameLoad Return NameLoad Return SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str ListLoad Num For NameStore Call NameLoad Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad If CompareNotEq AttributeLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr attr Str body Raise Call NameLoad BinOpMod Str AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad AttributeLoad NameLoad attr keyword NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr keyword SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr BinOpDiv Num SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Index Num orelse Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad If CompareNotEq Call AttributeLoad NameLoad attr NameLoad Num body Raise Call NameLoad Call AttributeLoad Str attr NameLoad If CompareNotEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Index Num body Raise Call NameLoad Call AttributeLoad Str attr NameLoad SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num If CompareNotIn Num SubscriptLoad NameLoad Index NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num Assign NameStore Call NameLoad NameLoad If CompareGt SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Index Num Num body Assign NameStore BinOpSub Num SubscriptLoad NameLoad Index CompareEq SubscriptLoad NameLoad Index NameLoad Num Assign NameStore Call NameLoad BinOpMult NameLoad NameLoad Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore CompareNotEq SubscriptLoad NameLoad Index NameLoad Num Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore BinOpDiv NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Return Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad TupleLoad NameLoad Call NameLoad NameLoad keyword NameLoad decorator_list
N/A __future__ division N/A numpy np N/A scipy.sparse sp N/A operator N/A array sklearn.utils check_random_state sklearn.utils.fixes astype _random sample_without_replacement N/A __all__ N/A sample_without_replacement choice choice N/A N/A a size replace p random_state N/A None True None None N/A N/A 
    choice(a, size=None, replace=True, p=None)

    Generates a random sample from a given 1-D array

    .. versionadded:: 1.7.0

    Parameters
    -----------
    a : 1-D array-like or int
        If an ndarray, a random sample is generated from its elements.
        If an int, the random sample is generated as if a was np.arange(n)

    size : int or tuple of ints, optional
        Output shape. Default is None, in which case a single value is
        returned.

    replace : boolean, optional
        Whether the sample is with or without replacement.

    p : 1-D array-like, optional
        The probabilities associated with each entry in a.
        If not given the sample assumes a uniform distribution over all
        entries in a.

    random_state : int, RandomState instance or None, optional (default=None)
        If int, random_state is the seed used by the random number generator;
        If RandomState instance, random_state is the random number generator;
        If None, the random number generator is the RandomState instance used
        by `np.random`.


    Returns
    --------
    samples : 1-D ndarray, shape (size,)
    The generated random samples

    Raises
    -------
    ValueError
    If a is an int and less than zero, if a or p are not 1-dimensional,
    if a is an array-like of size 0, if p is not a vector of
    probabilities, if a and p have different lengths, or if
    replace=False and the sample size is greater than the population
    size

    See Also
    ---------
    randint, shuffle, permutation

    Examples
    ---------
    Generate a uniform random sample from np.arange(5) of size 3:

    >>> np.random.choice(5, 3)  # doctest: +SKIP
    array([0, 3, 4])
    >>> #This is equivalent to np.random.randint(0,5,3)

    Generate a non-uniform random sample from np.arange(5) of size 3:

    >>> np.random.choice(5, 3, p=[0.1, 0, 0.3, 0.6, 0])  # doctest: +SKIP
    array([3, 3, 0])

    Generate a uniform random sample from np.arange(5) of size 3 without
    replacement:

    >>> np.random.choice(5, 3, replace=False)  # doctest: +SKIP
    array([3,1,0])
    >>> #This is equivalent to np.random.shuffle(np.arange(5))[:3]

    Generate a non-uniform random sample from np.arange(5) of size
    3 without replacement:

    >>> np.random.choice(5, 3, replace=False, p=[0.1, 0, 0.3, 0.6, 0])
    ... # doctest: +SKIP
    array([2, 3, 0])

    Any of the above can be repeated with an arbitrary array-like
    instead of just integers. For instance:

    >>> aa_milne_arr = ['pooh', 'rabbit', 'piglet', 'Christopher']
    >>> np.random.choice(aa_milne_arr, 5, p=[0.5, 0.1, 0.1, 0.3])
    ... # doctest: +SKIP
    array(['pooh', 'pooh', 'pooh', 'Christopher', 'piglet'],
    dtype='|S11')

     N/A random_state N/A check_random_state random_state N/A a N/A N/A np array a copy False N/A N/A N/A a ndim 0 N/A N/A N/A N/A pop_size N/A N/A operator index N/A N/A a item N/A N/A N/A TypeError N/A N/A N/A ValueError a must be 1-dimensional or an integer N/A N/A pop_size 0 N/A N/A N/A ValueError a must be greater than 0 N/A N/A N/A N/A a ndim 1 N/A N/A N/A ValueError a must be 1-dimensional N/A N/A pop_size N/A N/A a shape N/A 0 N/A N/A pop_size 0 N/A N/A N/A ValueError a must be non-empty N/A N/A None p N/A N/A p N/A N/A np array p dtype N/A np double ndmin 1 copy False N/A N/A N/A p ndim 1 N/A N/A N/A ValueError p must be 1-dimensional N/A N/A N/A p size pop_size N/A N/A N/A ValueError a and p must have same size N/A N/A N/A np any N/A p 0 N/A N/A N/A ValueError probabilities are not non-negative N/A N/A N/A N/A np allclose N/A N/A p sum 1 N/A N/A N/A ValueError probabilities do not sum to 1 N/A shape size N/A N/A shape None N/A N/A size N/A N/A np prod shape dtype N/A np intp N/A N/A size 1 N/A replace N/A N/A N/A None p N/A N/A cdf N/A N/A p cumsum N/A cdf N/A cdf N/A -1 N/A uniform_samples N/A N/A random_state random_sample shape N/A idx N/A N/A cdf searchsorted uniform_samples side right N/A idx N/A N/A np array idx copy False N/A N/A idx N/A N/A random_state randint 0 pop_size size shape N/A N/A N/A size pop_size N/A N/A N/A ValueError Cannot take a larger sample than population when 'replace=False' N/A N/A None p N/A N/A N/A N/A N/A np sum N/A p 0 size N/A N/A N/A ValueError Fewer non-zero entries in p than size N/A n_uniq 0 N/A p N/A N/A p copy N/A found N/A N/A np zeros shape dtype N/A np int N/A flat_found N/A N/A found ravel N/A N/A n_uniq size N/A N/A x N/A N/A random_state rand N/A size n_uniq N/A N/A n_uniq 0 N/A N/A N/A p N/A N/A flat_found N/A 0 n_uniq 0 N/A cdf N/A N/A np cumsum p N/A cdf N/A cdf N/A -1 N/A new N/A N/A cdf searchsorted x side right N/A N/A _ unique_indices N/A N/A np unique new return_index True N/A N/A N/A unique_indices sort N/A new N/A N/A new take unique_indices N/A N/A flat_found N/A n_uniq N/A n_uniq N/A new size new N/A n_uniq N/A new size N/A idx found N/A N/A idx N/A N/A N/A random_state permutation pop_size N/A size N/A N/A shape None N/A N/A N/A idx shape shape N/A N/A N/A shape None N/A isinstance idx N/A np ndarray N/A N/A idx N/A N/A idx item 0 N/A N/A N/A a ndim 0 N/A N/A idx N/A N/A N/A shape None N/A N/A idx ndim 0 N/A N/A res N/A N/A np empty N/A dtype N/A a dtype N/A N/A res N/A N/A N/A a N/A idx N/A res N/A N/A a N/A idx N/A random_choice_csc N/A N/A n_samples classes class_probability random_state N/A None None N/A N/A Generate a sparse random matrix given column class distributions

    Parameters
    ----------
    n_samples : int,
        Number of samples to draw in each column.

    classes : list of size n_outputs of arrays of size (n_classes,)
        List of classes for each column.

    class_probability : list of size n_outputs of arrays of size (n_classes,)
        Optional (default=None). Class distribution of each column. If None the
        uniform distribution is assumed.

    random_state : int, RandomState instance or None, optional (default=None)
        If int, random_state is the seed used by the random number generator;
        If RandomState instance, random_state is the random number generator;
        If None, the random number generator is the RandomState instance used
        by `np.random`.

    Returns
    -------
    random_matrix : sparse csc matrix of size (n_samples, n_outputs)

     N/A data N/A N/A array array i N/A indices N/A N/A array array i N/A indptr N/A N/A array array i N/A 0 N/A j N/A range N/A len classes N/A N/A N/A classes N/A j N/A N/A np asarray N/A classes N/A j N/A N/A N/A N/A N/A classes N/A j dtype kind i N/A N/A N/A ValueError N/A class dtype %s is not supported N/A N/A classes N/A j dtype N/A N/A classes N/A j N/A astype N/A classes N/A j N/A np int64 copy False N/A N/A class_probability None N/A N/A class_prob_j N/A N/A np empty shape N/A N/A N/A classes N/A j shape N/A 0 N/A N/A N/A class_prob_j fill N/A 1 N/A N/A N/A classes N/A j shape N/A 0 N/A N/A class_prob_j N/A N/A np asarray N/A class_probability N/A j N/A N/A N/A N/A np sum class_prob_j 1.0 N/A N/A N/A ValueError N/A N/A Probability array at index {0} does not sum to one format j N/A N/A N/A N/A class_prob_j shape N/A 0 N/A N/A N/A classes N/A j shape N/A 0 N/A N/A N/A ValueError N/A N/A classes[{0}] (length {1}) and class_probability[{0}] (length {2}) have different length. format j N/A N/A N/A classes N/A j shape N/A 0 N/A N/A class_prob_j shape N/A 0 N/A N/A 0 N/A classes N/A j N/A N/A N/A classes N/A j N/A N/A np insert N/A classes N/A j 0 0 N/A class_prob_j N/A N/A np insert class_prob_j 0 0.0 N/A rng N/A check_random_state random_state N/A N/A N/A N/A N/A classes N/A j shape N/A 0 1 N/A N/A p_nonzero N/A 1 N/A class_prob_j N/A N/A N/A classes N/A j 0 N/A nnz N/A int N/A n_samples p_nonzero N/A ind_sample N/A sample_without_replacement n_population n_samples n_samples nnz random_state random_state N/A N/A N/A indices extend ind_sample N/A classes_j_nonzero N/A N/A classes N/A j 0 N/A class_probability_nz N/A class_prob_j N/A classes_j_nonzero N/A class_probability_nz_norm N/A class_probability_nz N/A N/A np sum class_probability_nz N/A classes_ind N/A N/A np searchsorted N/A N/A class_probability_nz_norm cumsum N/A N/A rng rand nnz N/A N/A N/A data extend N/A N/A N/A classes N/A j N/A classes_j_nonzero N/A classes_ind N/A N/A N/A indptr append N/A len indices N/A N/A N/A sp csc_matrix N/A data indices indptr N/A n_samples N/A len classes dtype int N/A