
    -i",                    
   S r SSKrSSKrSSKJr  SSKJrJr  SSKrSSK	J
r  SSKJr  SSKJr  SSKJr  SS	KJrJr  SS
KJr  SSKJrJrJr  SSKJr  S r\" 0 S\" \SSSS9/_S\" \SSSS9/_S\" \SSSS9/_S\" \SSSS9/_S\" \SSSS9/_S\" \SSSS9/_S\" \SSSS9/_SSS/_S\" \SSSS9/_S\" \SSSS9/_SS/_S \" \SSSS9SS/_S!\" \SSSS9SS/_S"S/_S#S#/_S$S/_S%S&9  SjSSSSSSS(S)S%S*S)S%SS%S+.S, jj5       r\" \" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/S/S/\" S-S.15      S/S/S#/S/.
S%S&9  SjS0SS1S%S2S-S2SS3.S4 jj5       r\" \" \SSSS9/S#/S5.S%S&9SkSS6.S7 jj5       r \" \" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9S/\" \SSSS9/\" \SSSS9/S/S/S#/S8.S%S&9  SlS9SS*SS:S*S%S2SS;.	S< jj5       r!\" \" \SSSS9\"/S/\" \SSSS9S/S#/\" \SSSS9/S=.S%S&9 SmS%SSS>S?.S@ jj5       r#\" \" \SSSS9\"/S/\" \SSSS9S/S#/SA.S%S&9SmS%SSSB.SC jj5       r$\" \" \SSSS9S/\" \SSSS9/\" \SSSS9SS/\" \SSSS9S/\"/S/S#/S/SD.S%S&9  SnSS)SES%SS2SF.SG jj5       r%\" \" \SSSS9/\" \S0SSS9/\" \S*SSS9/S#/SH.S%S&9SoS*SSI.SJ jj5       r&\" \" \SSSS9/\" \SSSS9/S#/SK.S%S&9SmS*SSI.SL jj5       r'\" \" \SSSS9/\" \SSSS9/S#/SK.S%S&9SmS*SSI.SM jj5       r(\" \" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/S#/SN.S%S&9  SlS9S:SSO.SP jj5       r)\" \" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/S#/SQ.S%S&9SS6.SR j5       r*\" \" \SSSS9/\" \SSSS9/S#/SS.S%S&9SoSS6.ST jj5       r+\" \" \SSSS9/S#/SU.S%S&9SS6.SV j5       r,\" \" \SSSS9/\" \SSSS9/S/\" \SSSS9/\" \SSSS9/\" 1 SWk5      S/S#/SX.S%S&9 SpSYS2SZS[SSS\.S] jj5       r-\" \" \SSSS9/\" \SSSS9/S#/S/S^.S%S&9SmS*SS2S_.S` jj5       r.\" \" \SSSS9/\" \SSSS9/S#/SK.S%S&9SmS*SSI.Sa jj5       r/\" SS/\" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/S/S#/Sb.S%S&9SS)S'SScS%SSb.Sd j5       r0SqSe jr1\" \"/\" \SSSS9/\" \SSSS9/\" \SSSS9/\" \SSSS9/S/S#/Sf.S%S&9S*S9S'S%SSg.Sh j5       r2\" \"/\" \SSSS9S/\" \SSSS9/\" \SSSS9/\" \SSSS9/S/S#/Sf.S%S&9S*S9S'S%SSg.Si j5       r3g)rz*
Generate samples of synthetic data sets.
    N)Iterable)IntegralReal)linalg)Bunch   )MultiLabelBinarizer)check_arraycheck_random_state)shuffle)Interval
StrOptionsvalidate_params)sample_without_replacementc                 .   US:  a5  [         R                  " UR                  SXS-
  4S9[        U SU5      /5      $ [	        SU-  XS9R                  SSS9n[         R                  " UR                  S5      5      R                  S	5      S
S
2U* S
24   nU$ )z5Returns distinct binary samples of length dimensions.   r   sizerandom_statez>u4F)dtypecopyz>u1)    N)	nphstackrandint_generate_hypercuber   astype
unpackbitsviewreshape)samples
dimensionsrngouts       V/var/www/html/venv/lib/python3.13/site-packages/sklearn/datasets/_samples_generator.pyr   r      s    ByyAW2o$>?#GR5
 	
 %Q
]G
N
U
U% V C --
(
0
0
:1zkl?
KCJ    	n_samples   left)closed
n_featuresn_informativen_redundant
n_repeated	n_classesn_clusters_per_classweightsz
array-likeflip_yboth	class_sepneither	hypercubebooleanshiftscaler   r   
return_X_yT)prefer_skip_nested_validationd   g{Gz?      ?        )r.   r/   r0   r1   r2   r3   r4   r6   r8   r:   r;   r   r   r<   c          	      p	   [        U5      nX#-   U-   U:  a  [        S5      eU[        R                  " XV-  5      :  a&  SnUS-  n[        UR	                  XVUSU-  5      5      eUb  [        U5      XUS-
  4;  a  [        S5      e[        U5      US-
  :X  aS  [        U[        5      (       a  US[        U5      -
  /-   nOE[        R                  " Xu5      nS[        USS	 5      -
  US	'   OUR                  5       nO	SU-  /U-  nX-
  U-
  U-
  nXV-  n[        U5       Vs/ s H  n[        U UUU-     -  U-  5      PM     nn[        U [        U5      -
  5       H  nUUU-  ==   S-  ss'   M     [        R                  " X45      n[        R                  " U [        S
9n[        UUU5      R                  [         SS9nUSU	-  -  nUU	-  nU
(       d(  UUR#                  US4S9-  nUUR#                  SU4S9-  nUR%                  X4S9USS2SU24'   Sn['        U5       HX  u  nnUUUU   -   nnUU-  UUU& UUU2SU24   nSUR#                  X"4S9-  S-
  n[        R(                  " UU5      US'   UU-  nMZ     US:  aA  SUR#                  X#4S9-  S-
  n [        R(                  " USS2SU24   U 5      USS2X"U-   24'   X#-   n!US:  aJ  U!S-
  UR#                  US9-  S-   R                  [        R*                  5      n"USS2U"4   USS2U!U!U-   24'   US:  a  UR%                  U U4S9USS2U* S24'   US:  a3  UR#                  U S9U:  n#UR-                  UU#R                  5       S9UU#'   Uc  SUR#                  US9-  S-
  U	-  nUU-  nUc  SSUR#                  US9-  -   nUU-  n[        R.                  " U5      n"U(       a1  [1        UUUS9u  nnUR3                  U"5        USS2U"4   USS2SS24'   U(       a  UU4$ S/U-  n$['        U"5       HG  u  nn%U%U:  a  SU$U'   M  UU%s=::  a  X#-   :  a
  O  OSU$U'   M,  U!U%s=::  a  U!U-   :  d  M>  O  MB  SU$U'   MI     0 SU _SU_SU_SU_SU_SU_SU_SU_S U_S!U	_S"U
_S#U_S$U_S%U_S&U_S'U_n&[5        [6        R8                  U&U$UUS(9n'U'$ s  snf ))a  Generate a random n-class classification problem.

This initially creates clusters of points normally distributed (std=1)
about vertices of an ``n_informative``-dimensional hypercube with sides of
length ``2*class_sep`` and assigns an equal number of clusters to each
class. It introduces interdependence between these features and adds
various types of further noise to the data.

Without shuffling, ``X`` horizontally stacks features in the following
order: the primary ``n_informative`` features, followed by ``n_redundant``
linear combinations of the informative features, followed by ``n_repeated``
duplicates, drawn randomly with replacement from the informative and
redundant features. The remaining features are filled with random noise.
Thus, without shuffling, all useful features are contained in the columns
``X[:, :n_informative + n_redundant + n_repeated]``.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

n_features : int, default=20
    The total number of features. These comprise ``n_informative``
    informative features, ``n_redundant`` redundant features,
    ``n_repeated`` duplicated features and
    ``n_features-n_informative-n_redundant-n_repeated`` useless features
    drawn at random.

n_informative : int, default=2
    The number of informative features. Each class is composed of a number
    of gaussian clusters each located around the vertices of a hypercube
    in a subspace of dimension ``n_informative``. For each cluster,
    informative features are drawn independently from  N(0, 1) and then
    randomly linearly combined within each cluster in order to add
    covariance. The clusters are then placed on the vertices of the
    hypercube.

n_redundant : int, default=2
    The number of redundant features. These features are generated as
    random linear combinations of the informative features.

n_repeated : int, default=0
    The number of duplicated features, drawn randomly from the informative
    and the redundant features.

n_classes : int, default=2
    The number of classes (or labels) of the classification problem.

n_clusters_per_class : int, default=2
    The number of clusters per class.

weights : array-like of shape (n_classes,) or (n_classes - 1,),              default=None
    The proportions of samples assigned to each class. If None, then
    classes are balanced. Note that if ``len(weights) == n_classes - 1``,
    then the last class weight is automatically inferred.
    More than ``n_samples`` samples may be returned if the sum of
    ``weights`` exceeds 1. Note that the actual class proportions will
    not exactly match ``weights`` when ``flip_y`` isn't 0.

flip_y : float, default=0.01
    The fraction of samples whose class is assigned randomly. Larger
    values introduce noise in the labels and make the classification
    task harder. Note that the default setting flip_y > 0 might lead
    to less than ``n_classes`` in y in some cases.

class_sep : float, default=1.0
    The factor multiplying the hypercube size.  Larger values spread
    out the clusters/classes and make the classification task easier.

hypercube : bool, default=True
    If True, the clusters are put on the vertices of a hypercube. If
    False, the clusters are put on the vertices of a random polytope.

shift : float, ndarray of shape (n_features,) or None, default=0.0
    Shift features by the specified value. If None, then features
    are shifted by a random value drawn in [-class_sep, class_sep].

scale : float, ndarray of shape (n_features,) or None, default=1.0
    Multiply features by the specified value. If None, then features
    are scaled by a random value drawn in [1, 100]. Note that scaling
    happens after shifting.

shuffle : bool, default=True
    Shuffle the samples and the features.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

return_X_y : bool, default=True
    If True, a tuple ``(X, y)`` instead of a Bunch object is returned.

    .. versionadded:: 1.7

Returns
-------
data : :class:`~sklearn.utils.Bunch` if `return_X_y` is `False`.
    Dictionary-like object, with the following attributes.

    DESCR : str
        A description of the function that generated the dataset.
    parameter : dict
        A dictionary that stores the values of the arguments passed to the
        generator function.
    feature_info : list of len(n_features)
        A description for each generated feature.
    X : ndarray of shape (n_samples, n_features)
        The generated samples.
    y : ndarray of shape (n_samples,)
        An integer label for class membership of each sample.

    .. versionadded:: 1.7

(X, y) : tuple if ``return_X_y`` is True
    A tuple of generated samples and labels.

See Also
--------
make_blobs : Simplified variant.
make_multilabel_classification : Unrelated generator for multilabel tasks.

Notes
-----
The algorithm is adapted from Guyon [1] and was designed to generate
the "Madelon" dataset.

References
----------
.. [1] I. Guyon, "Design of experiments for the NIPS 2003 variable
       selection benchmark", 2003.

Examples
--------
>>> from sklearn.datasets import make_classification
>>> X, y = make_classification(random_state=42)
>>> X.shape
(100, 20)
>>> y.shape
(100,)
>>> list(y[:5])
[np.int64(0), np.int64(0), np.int64(1), np.int64(1), np.int64(0)]
ziNumber of informative, redundant and repeated features must sum to less than the number of total featuresz0n_classes({}) * n_clusters_per_class({}) must bez) smaller or equal 2**n_informative({})={}r   Nr*   z:Weights specified but incompatible with number of classes.r?   r   r   Fr   r   r   .      ?r@   r>   r   randominformative	redundantrepeatedr)   r-   r.   r/   r0   r1   r2   r3   r4   r6   r8   r:   r;   r   r   r<   )DESCR
parametersfeature_infoXy)r   
ValueErrorr   log2formatlen
isinstancelistsumresizer   rangeintzerosr   r   floatuniformstandard_normal	enumeratedotintpr   arangeutil_shuffler   r   make_classification__doc__)(r)   r-   r.   r/   r0   r1   r2   r3   r4   r6   r8   r:   r;   r   r   r<   	generatormsgweights_n_random
n_clusterskn_samples_per_clusterirL   rM   	centroidsstopcentroidstartX_kABnindices	flip_mask	feat_descindexrJ   bunchs(                                           r'   ra   ra   *   s3   t #<0I "Z/*<
 	
 rwwy?@@@::JJyq-GWX
 	
 w<	q=99L  w<9q=('4(("cCL&8%9999W8"S#2%77||~H)O$y0)K7*DH1J
 z""A 	IY//2FFG"  
 9s#899:a*n-2- ; 	)()A
#&A $JyIPPE Q I YIIY&&ZO&<<	Y&&Q,>&??	 %449:T4UAa- D +8D#8#;;tI%d
N]N*+	!!'E!FFJ66#q>Cx , Q	!!'C!DDqH<>FFa- !=
!][88
89
 	#AA~EY..J.??#EMMbggV#$QZ=!QZ
  !|$449h:O4P!hYZ- }%%9%5>	 (((I) }Y&&J&77!;yHJA}C)+++<<<JAii
#GAqy91 	'"AwJ-!Q$!t 
Z'Ig&5= (IaLeAm&AA&IaL%(!j.((%IaL 'Yj 	 	{	
 	j 	Y 	 4 	7 	& 	Y 	Y 	 	 	7 	  	j!J& !))

E Lks   !R3densesparse)
r)   r-   r1   n_labelslengthallow_unlabeledry   return_indicatorreturn_distributionsr      2   F)r1   rz   r{   r|   ry   r}   r~   r   c                ~  ^^^^^^^ [        U	5      mTR                  US9n
XR                  5       -  n
[        R                  " U
5      mTR                  TU4S9mT[        R                  " TSS9-  mUUUUUUU4S jn[
        R
                  " S5      n[
        R
                  " SS/5      n/ n[        U 5       HI  nU" 5       u  nnUR                  U5        UR                  [        U5      5        UR                  U5        MK     [        R                  " [        U5      [        R                  S9n[        R                  " UX4U T4S9nUR                  5         U(       d  UR                  5       nUS;   a6  [!        US	:H  S
9nUR#                  [        U5      /5      R%                  U5      nU(       a  UXT4$ UU4$ )aL  Generate a random multilabel classification problem.

For each sample, the generative process is:
    - pick the number of labels: n ~ Poisson(n_labels)
    - n times, choose a class c: c ~ Multinomial(theta)
    - pick the document length: k ~ Poisson(length)
    - k times, choose a word: w ~ Multinomial(theta_c)

In the above process, rejection sampling is used to make sure that
n is never zero or more than `n_classes`, and that the document length
is never zero. Likewise, we reject classes which have already been chosen.

For an example of usage, see
:ref:`sphx_glr_auto_examples_datasets_plot_random_multilabel_dataset.py`.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

n_features : int, default=20
    The total number of features.

n_classes : int, default=5
    The number of classes of the classification problem.

n_labels : int, default=2
    The average number of labels per instance. More precisely, the number
    of labels per sample is drawn from a Poisson distribution with
    ``n_labels`` as its expected value, but samples are bounded (using
    rejection sampling) by ``n_classes``, and must be nonzero if
    ``allow_unlabeled`` is False.

length : int, default=50
    The sum of the features (number of words if documents) is drawn from
    a Poisson distribution with this expected value.

allow_unlabeled : bool, default=True
    If ``True``, some instances might not belong to any class.

sparse : bool, default=False
    If ``True``, return a sparse feature matrix.

    .. versionadded:: 0.17
       parameter to allow *sparse* output.

return_indicator : {'dense', 'sparse'} or False, default='dense'
    If ``'dense'`` return ``Y`` in the dense binary indicator format. If
    ``'sparse'`` return ``Y`` in the sparse binary indicator format.
    ``False`` returns a list of lists of labels.

return_distributions : bool, default=False
    If ``True``, return the prior class probability and conditional
    probabilities of features given classes, from which the data was
    drawn.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The generated samples.

Y : {ndarray, sparse matrix} of shape (n_samples, n_classes)
    The label sets. Sparse matrix should be of CSR format.

p_c : ndarray of shape (n_classes,)
    The probability of each class being drawn. Only returned if
    ``return_distributions=True``.

p_w_c : ndarray of shape (n_features, n_classes)
    The probability of each feature being drawn given each class.
    Only returned if ``return_distributions=True``.

Examples
--------
>>> from sklearn.datasets import make_multilabel_classification
>>> X, y = make_multilabel_classification(n_labels=3, random_state=42)
>>> X.shape
(100, 20)
>>> y.shape
(100, 5)
>>> list(y[:3])
[array([1, 1, 0, 1, 0]), array([0, 1, 1, 1, 0]), array([0, 1, 0, 0, 0])]
r   r   axisc            	        > TR                   u  pUS-   nT(       d  US:X  d  X!:  a'  T
R                  T5      nT(       d  US:X  a  M   X!:  a  M'  [        5       n[        U5      U:w  aR  [        R
                  " T	T
R                  U[        U5      -
  S95      nUR                  U5        [        U5      U:w  a  MR  [        U5      nSnUS:X  a  T
R                  T5      nUS:X  a  M  [        U5      S:X  a  T
R                  TUS9nXc4$ TR                  USS9R                  SS9R                  5       nXwS   -  n[        R
                  " UT
R                  US95      nXc4$ )Nr*   r   r   r   r   )shapepoissonsetrQ   r   searchsortedrZ   updaterS   r   takerT   cumsum)_r1   y_sizerM   cn_wordswordscumulative_p_w_sampler|   cumulative_p_crc   r{   r-   rz   p_w_cs           r'   sample_example6make_multilabel_classification.<locals>.sample_example   sY   {{ Q"v{v7I&&x0F #v{v7I E!f	0A0AvPSTUPV0A0WXAHHQK !f G l''/G l q6Q;%%jw%?E8O !&

11
 5 9 9q 9 A H H Jr!:: 5y7H7Hg7H7VWxr(   rj   rB   )r   )Try   rx   ry   )sparse_output)r   rZ   rT   r   r   arrayrV   extendappendrQ   onesfloat64sp
csr_matrixsum_duplicatestoarrayr	   fit	transform)r)   r-   r1   rz   r{   r|   ry   r}   r~   r   p_cr   	X_indicesX_indptrYrj   r   rM   X_datarL   lbr   rc   r   s    ` ```               @@@r'   make_multilabel_classificationr     s   n #<0I




+C779CYYs^NJ	#:;E	RVVE""E B C I{{3$H
A9!#qI'		 
 WWS^2::6F
vy3Iz;RSAIIK 44 0@H0LNFFE)$%&003!%a4Kr(   )r)   r   r   c                    [        U5      nU S4nUR                  US9R                  U5      nUS-  R                  SS9S:  R	                  [
        R                  SS9nS	XUS
:H  '   XE4$ )a  Generate data for binary classification used in Hastie et al. 2009, Example 10.2.

The ten features are standard independent Gaussian and
the target ``y`` is defined by::

  y[i] = 1 if np.sum(X[i] ** 2) > 9.34 else -1

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=12000
    The number of samples.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, 10)
    The input samples.

y : ndarray of shape (n_samples,)
    The output values.

See Also
--------
make_gaussian_quantiles : A generalization of this dataset approach.

References
----------
.. [1] T. Hastie, R. Tibshirani and J. Friedman, "Elements of Statistical
       Learning Ed. 2", Springer, 2009.

Examples
--------
>>> from sklearn.datasets import make_hastie_10_2
>>> X, y = make_hastie_10_2(n_samples=24000, random_state=42)
>>> X.shape
(24000, 10)
>>> y.shape
(24000,)
>>> list(y[:5])
[np.float64(-1.0), np.float64(1.0), np.float64(-1.0), np.float64(1.0),
np.float64(-1.0)]

   r          @r*   r   gGz"@FrC         r@   )r   normalr"   rT   r   r   r   )r)   r   rsr   rL   rM   s         r'   make_hastie_10_2r   8  sr    p 
L	)BOE
		u	%%e,A
S&1		$,,RZZe,DAA3hK4Kr(   )r)   r-   r.   	n_targetsbiaseffective_ranktail_strengthnoiser   coefr   r   rD   )	r.   r   r   r   r   r   r   r   r   c       	         Z   [        X5      n[        U
5      nUc  UR                  X4S9nO[        U UUUUS9n[        R
                  " X45      nSUR                  X#4S9-  USU2SS24'   [        R                  " X5      U-   nUS:  a  XR                  X~R                  S9-  nU(       aI  [        XUS9u  p[        R                  " U5      nUR                  U5        USS2U4   USS2SS24'   X   n[        R                  " U5      nU	(       a  X[        R                  " U5      4$ X4$ )a  Generate a random regression problem.

The input set can either be well conditioned (by default) or have a low
rank-fat tail singular profile. See :func:`make_low_rank_matrix` for
more details.

The output is generated by applying a (potentially biased) random linear
regression model with `n_informative` nonzero regressors to the previously
generated input and some gaussian centered noise with some adjustable
scale.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

n_features : int, default=100
    The number of features.

n_informative : int, default=10
    The number of informative features, i.e., the number of features used
    to build the linear model used to generate the output.

n_targets : int, default=1
    The number of regression targets, i.e., the dimension of the y output
    vector associated with a sample. By default, the output is a scalar.

bias : float, default=0.0
    The bias term in the underlying linear model.

effective_rank : int, default=None
    If not None:
        The approximate number of singular vectors required to explain most
        of the input data by linear combinations. Using this kind of
        singular spectrum in the input allows the generator to reproduce
        the correlations often observed in practice.
    If None:
        The input set is well conditioned, centered and gaussian with
        unit variance.

tail_strength : float, default=0.5
    The relative importance of the fat noisy tail of the singular values
    profile if `effective_rank` is not None. When a float, it should be
    between 0 and 1.

noise : float, default=0.0
    The standard deviation of the gaussian noise applied to the output.

shuffle : bool, default=True
    Shuffle the samples and the features.

coef : bool, default=False
    If True, the coefficients of the underlying linear model are returned.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The input samples.

y : ndarray of shape (n_samples,) or (n_samples, n_targets)
    The output values.

coef : ndarray of shape (n_features,) or (n_features, n_targets)
    The coefficient of the underlying linear model. It is returned only if
    coef is True.

Examples
--------
>>> from sklearn.datasets import make_regression
>>> X, y = make_regression(n_samples=5, n_features=2, noise=1, random_state=42)
>>> X
array([[ 0.4967, -0.1382 ],
    [ 0.6476,  1.523],
    [-0.2341, -0.2341],
    [-0.4694,  0.5425],
    [ 1.579,  0.7674]])
>>> y
array([  6.737,  37.79, -10.27,   0.4017,   42.22])
Nr   r)   r-   r   r   r   r>   r@   r;   r   r   )minr   r[   make_low_rank_matrixr   rX   rZ   r]   r   r   r`   r_   r   squeeze)r)   r-   r.   r   r   r   r   r   r   r   r   rc   rL   ground_truthrM   rs   s                   r'   make_regressionr   z  sD   h 
2M"<0I%%I+B%C !!)'"
 88Z34L&)I,=,=' -> - 'L-"# 	q$&A s{	E88 Ay9))J''"AwJ-!Q$#,


1ARZZ--- tr(   )r)   r   r   r   factorg?)r   r   r   r   c                   [        U [        R                  5      (       a
  U S-  nX-
  nO[        U 5      S:w  a  [	        S5      eU u  pV[        U5      n[        R                  " SS[        R                  -  USS9n[        R                  " SS[        R                  -  USS9n	[        R                  " U5      n
[        R                  " U5      n[        R                  " U	5      U-  n[        R                  " U	5      U-  n[        R                  " [        R                  " X5      [        R                  " X5      /5      R                  n[        R                  " [        R                  " U[        R                   S9[        R"                  " U[        R                   S9/5      nU(       a  [%        XUS9u  pUb  XR'                  X.R(                  S9-  nX4$ )	a  Make a large circle containing a smaller circle in 2d.

A simple toy dataset to visualize clustering and classification
algorithms.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int or tuple of shape (2,), dtype=int, default=100
    If int, it is the total number of points generated.
    For odd numbers, the inner circle will have one point more than the
    outer circle.
    If two-element tuple, number of points in outer circle and inner
    circle.

    .. versionchanged:: 0.23
       Added two-element tuple.

shuffle : bool, default=True
    Whether to shuffle the samples.

noise : float, default=None
    Standard deviation of Gaussian noise added to the data.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset shuffling and noise.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

factor : float, default=.8
    Scale factor between inner and outer circle in the range `[0, 1)`.

Returns
-------
X : ndarray of shape (n_samples, 2)
    The generated samples.

y : ndarray of shape (n_samples,)
    The integer labels (0 or 1) for class membership of each sample.

Examples
--------
>>> from sklearn.datasets import make_circles
>>> X, y = make_circles(random_state=42)
>>> X.shape
(100, 2)
>>> y.shape
(100,)
>>> list(y[:5])
[np.int64(1), np.int64(1), np.int64(1), np.int64(0), np.int64(0)]
r   z7When a tuple, n_samples must have exactly two elements.r   F)endpointrB   r   r   )rR   numbersr   rQ   rN   r   r   linspacepicossinvstackr   Tr   rX   r^   r   r`   r   r   )r)   r   r   r   r   n_samples_outn_samples_inrc   linspace_outlinspace_inouter_circ_xouter_circ_yinner_circ_xinner_circ_yrL   rM   s                   r'   make_circlesr     sm   B )W--..!Q 0y>QVWW&/#"<0I;;q!bee)]UKL++aRUUL5IK66,'L66,'L66+&/L66+&/L
			<	.		,0UV	a  				-rww	/RWW1UV	A Ay9	E884Kr(   )r)   r   r   r   )r   r   r   c                B   [        U [        R                  5      (       a
  U S-  nX-
  nO U u  pE[	        U5      n[
        R                  " [
        R                  " S[
        R                  U5      5      n[
        R                  " [
        R                  " S[
        R                  U5      5      n	S[
        R                  " [
        R                  " S[
        R                  U5      5      -
  n
S[
        R                  " [
        R                  " S[
        R                  U5      5      -
  S-
  n[
        R                  " [
        R                  " X5      [
        R                  " X5      /5      R                  n[
        R                  " [
        R                  " U[
        R                  S9[
        R                   " U[
        R                  S9/5      nU(       a  [#        XUS9u  pUb  XR%                  X,R&                  S	9-  nX4$ ! [         a  n[        S5      UeSnAff = f)
a  Make two interleaving half circles.

A simple toy dataset to visualize clustering and classification
algorithms. Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int or tuple of shape (2,), dtype=int, default=100
    If int, the total number of points generated.
    If two-element tuple, number of points in each of two moons.

    .. versionchanged:: 0.23
       Added two-element tuple.

shuffle : bool, default=True
    Whether to shuffle the samples.

noise : float, default=None
    Standard deviation of Gaussian noise added to the data.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset shuffling and noise.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, 2)
    The generated samples.

y : ndarray of shape (n_samples,)
    The integer labels (0 or 1) for class membership of each sample.

Examples
--------
>>> from sklearn.datasets import make_moons
>>> X, y = make_moons(n_samples=200, noise=0.2, random_state=42)
>>> X.shape
(200, 2)
>>> y.shape
(200,)
r   z8`n_samples` can be either an int or a two-element tuple.Nr   r*   rD   rB   r   r   )rR   r   r   rN   r   r   r   r   r   r   r   r   r   r   rX   r^   r   r`   r   r   )r)   r   r   r   r   r   erc   r   r   r   r   rL   rM   s                 r'   
make_moonsr     s   j )W--..!Q 0	*3'M #<0I66"++a>?L66"++a>?Lrvvbkk!RUULABBLrvvbkk!RUULABBSHL
			<	.		,0UV	a  				-rww	/RWW1UV	A Ay9	E884K3  	J	s   H 
HHH)r)   r-   centerscluster_std
center_boxr   r   return_centers)g      $g      $@)r   r   r   r   r   r   c                x   [        U5      n[        U [        R                  5      (       ai  Uc  Sn[        U[        R                  5      (       a  Un	UR	                  US   US   X4S9nO[        U5      nUR                  S   nUR                  S   n	O[        U 5      n	Uc  UR	                  US   US   X4S9n[        U[        5      (       d  [        SR                  U5      5      e[        U5      U	:w  a  [        SU  SU 35      e[        U5      nUR                  S   n[        US5      (       a)  [        U5      U	:w  a  [        S	R                  X#5      5      e[        U[        R                  5      (       a   [        R                  " [        U5      U5      n[        U [        5      (       a  U n
O1[        X	-  5      /U	-  n
[!        X	-  5       H  nX==   S-  ss'   M     [        R"                  " U
5      n[        R$                  " ['        U
5      U4[        R(                  S
9n[        R$                  " ['        U
5      4[        S
9n[+        [-        X5      5       H7  u  nu  nnUS:  a  XS-
     OSnX   nUR/                  X+   UX4S9UUU& XUU& M9     U(       a  [1        XUS9u  pU(       a  XU4$ X4$ )a	  Generate isotropic Gaussian blobs for clustering.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int or array-like, default=100
    If int, it is the total number of points equally divided among
    clusters.
    If array-like, each element of the sequence indicates
    the number of samples per cluster.

    .. versionchanged:: v0.20
        one can now pass an array-like to the ``n_samples`` parameter

n_features : int, default=2
    The number of features for each sample.

centers : int or array-like of shape (n_centers, n_features), default=None
    The number of centers to generate, or the fixed center locations.
    If n_samples is an int and centers is None, 3 centers are generated.
    If n_samples is array-like, centers must be
    either None or an array of length equal to the length of n_samples.

cluster_std : float or array-like of float, default=1.0
    The standard deviation of the clusters.

center_box : tuple of float (min, max), default=(-10.0, 10.0)
    The bounding box for each cluster center when centers are
    generated at random.

shuffle : bool, default=True
    Shuffle the samples.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

return_centers : bool, default=False
    If True, then return the centers of each cluster.

    .. versionadded:: 0.23

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The generated samples.

y : ndarray of shape (n_samples,)
    The integer labels for cluster membership of each sample.

centers : ndarray of shape (n_centers, n_features)
    The centers of each cluster. Only returned if
    ``return_centers=True``.

See Also
--------
make_classification : A more intricate variant.

Examples
--------
>>> from sklearn.datasets import make_blobs
>>> X, y = make_blobs(n_samples=10, centers=3, n_features=2,
...                   random_state=0)
>>> print(X.shape)
(10, 2)
>>> y
array([0, 0, 1, 0, 2, 2, 2, 1, 1, 0])
>>> X, y = make_blobs(n_samples=[3, 3, 4], centers=None, n_features=2,
...                   random_state=0)
>>> print(X.shape)
(10, 2)
>>> y
array([0, 1, 2, 0, 2, 2, 2, 1, 1, 0])
   r   r*   r   z8Parameter `centers` must be array-like. Got {!r} insteadzMLength of `n_samples` not consistent with number of centers. Got n_samples = z and centers = __len__zeLength of `clusters_std` not consistent with number of centers. Got centers = {} and cluster_std = {}r   r   locr;   r   r   )r   rR   r   r   rZ   r
   r   rQ   r   rN   rP   hasattrr   r   fullrW   rV   r   emptyrT   r   r\   zipr   r`   )r)   r-   r   r   r   r   r   r   rc   	n_centersn_samples_per_centerrj   cum_sum_n_samplesrL   rM   rr   std	start_idxend_idxs                      r'   
make_blobsr     s   H #<0I)W--..?Ggw//00I''1z!}I3J ( G
 "'*G q)Ja(I 	N	?''1z!}I3J ( G '8,,JQQ 
 w<9$,,5;ogYP  g&]]1%
 {I&&3{+;y+H##)6'#?
 	
 +w||,,ggc'lK8)X&&( #I$: ;<yHy,-A #q(# . 		"67
01:>bjjQA
0133?A %9!GH8As01A%!e,1	#&(//
#QO  0  
)G  !)G I Ay9W}tr(   )r)   r-   r   r   )r   r   c                2   [        U5      nUR                  X4S9nS[        R                  " [        R                  USS2S4   -  USS2S4   -  5      -  SUSS2S4   S-
  S-  -  -   SUSS2S	4   -  -   S
USS2S4   -  -   X$R                  U S9-  -   nXV4$ )a  Generate the "Friedman #1" regression problem.

This dataset is described in Friedman [1] and Breiman [2].

Inputs `X` are independent features uniformly distributed on the interval
[0, 1]. The output `y` is created according to the formula::

    y(X) = 10 * sin(pi * X[:, 0] * X[:, 1]) + 20 * (X[:, 2] - 0.5) ** 2 + 10 * X[:, 3] + 5 * X[:, 4] + noise * N(0, 1).

Out of the `n_features` features, only 5 are actually used to compute
`y`. The remaining features are independent of `y`.

The number of features has to be >= 5.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

n_features : int, default=10
    The number of features. Should be at least 5.

noise : float, default=0.0
    The standard deviation of the gaussian noise applied to the output.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset noise. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The input samples.

y : ndarray of shape (n_samples,)
    The output values.

References
----------
.. [1] J. Friedman, "Multivariate adaptive regression splines", The Annals
       of Statistics 19 (1), pages 1-67, 1991.

.. [2] L. Breiman, "Bagging predictors", Machine Learning 24,
       pages 123-140, 1996.

Examples
--------
>>> from sklearn.datasets import make_friedman1
>>> X, y = make_friedman1(random_state=42)
>>> X.shape
(100, 10)
>>> y.shape
(100,)
>>> list(y[:3])
[np.float64(16.8), np.float64(5.87), np.float64(9.46)]
r   r   Nr   r*      r   rD   r   r      )r   rZ   r   r   r   r[   )r)   r-   r   r   rc   rL   rM   s          r'   make_friedman1r     s    L #<0I	67A
RVVBEEAadGOa1g-..
!Q$#!#
#	$
qAw,	 a1g+	 ++)+=
=		>  4Kr(   )r)   r   r   c                   [        U5      nUR                  U S4S9nUSS2S4==   S-  ss'   USS2S4==   S[        R                  -  -  ss'   USS2S4==   S[        R                  -  -  ss'   USS2S	4==   S
-  ss'   USS2S	4==   S-  ss'   USS2S4   S-  USS2S4   USS2S4   -  SUSS2S4   USS2S	4   -  -  -
  S-  -   S-  XR	                  U S9-  -   nXE4$ )a  Generate the "Friedman #2" regression problem.

This dataset is described in Friedman [1] and Breiman [2].

Inputs `X` are 4 independent features uniformly distributed on the
intervals::

    0 <= X[:, 0] <= 100,
    40 * pi <= X[:, 1] <= 560 * pi,
    0 <= X[:, 2] <= 1,
    1 <= X[:, 3] <= 11.

The output `y` is created according to the formula::

    y(X) = (X[:, 0] ** 2 + (X[:, 1] * X[:, 2]  - 1 / (X[:, 1] * X[:, 3])) ** 2) ** 0.5 + noise * N(0, 1).

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

noise : float, default=0.0
    The standard deviation of the gaussian noise applied to the output.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset noise. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, 4)
    The input samples.

y : ndarray of shape (n_samples,)
    The output values.

References
----------
.. [1] J. Friedman, "Multivariate adaptive regression splines", The Annals
       of Statistics 19 (1), pages 1-67, 1991.

.. [2] L. Breiman, "Bagging predictors", Machine Learning 24,
       pages 123-140, 1996.

Examples
--------
>>> from sklearn.datasets import make_friedman2
>>> X, y = make_friedman2(random_state=42)
>>> X.shape
(100, 4)
>>> y.shape
(100,)
>>> list(y[:3])
[np.float64(1229.4), np.float64(27.0), np.float64(65.6)]
r   r   Nr   r>   r*     (   r   r   r   rD   )r   rZ   r   r   r[   r)   r   r   rc   rL   rM   s         r'   make_friedman2r     s	   H #<0I	1~.AadGsNGadGsRUU{GadGrBEEzGadGrMGadGqLG 	
!Q$1!Q$!AqD')A1a41QT71B,CCII		00y0BB	CA 4Kr(   c                   [        U5      nUR                  U S4S9nUSS2S4==   S-  ss'   USS2S4==   S[        R                  -  -  ss'   USS2S4==   S[        R                  -  -  ss'   USS2S	4==   S
-  ss'   USS2S	4==   S-  ss'   [        R                  " USS2S4   USS2S4   -  SUSS2S4   USS2S	4   -  -  -
  USS2S4   -  5      XR                  U S9-  -   nXE4$ )a  Generate the "Friedman #3" regression problem.

This dataset is described in Friedman [1] and Breiman [2].

Inputs `X` are 4 independent features uniformly distributed on the
intervals::

    0 <= X[:, 0] <= 100,
    40 * pi <= X[:, 1] <= 560 * pi,
    0 <= X[:, 2] <= 1,
    1 <= X[:, 3] <= 11.

The output `y` is created according to the formula::

    y(X) = arctan((X[:, 1] * X[:, 2] - 1 / (X[:, 1] * X[:, 3])) / X[:, 0]) + noise * N(0, 1).

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

noise : float, default=0.0
    The standard deviation of the gaussian noise applied to the output.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset noise. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, 4)
    The input samples.

y : ndarray of shape (n_samples,)
    The output values.

References
----------
.. [1] J. Friedman, "Multivariate adaptive regression splines", The Annals
       of Statistics 19 (1), pages 1-67, 1991.

.. [2] L. Breiman, "Bagging predictors", Machine Learning 24,
       pages 123-140, 1996.

Examples
--------
>>> from sklearn.datasets import make_friedman3
>>> X, y = make_friedman3(random_state=42)
>>> X.shape
(100, 4)
>>> y.shape
(100,)
>>> list(y[:3])
[np.float64(1.54), np.float64(0.956), np.float64(0.414)]
r   r   Nr   r>   r*   r   r   r   r   r   )r   rZ   r   r   arctanr[   r   s         r'   make_friedman3r   3  s   H #<0I	1~.AadGsNGadGsRUU{GadGrBEEzGadGrMGadGqLG
			
1a41QT7	Q!AqD'AadG"34	4!Q$?	))	);;	<A 4Kr(   r   )r   r   r   c                2   [        U5      n[        X5      n[        R                  " UR	                  X4S9SSS9u  px[        R                  " UR	                  X4S9SSS9u  p[
        R                  " U[
        R                  S9n
SU-
  [
        R                  " SX-  S-  -  5      -  nU[
        R                  " S	U
-  U-  5      -  n[
        R                  " U5      X-   -  n[
        R                  " [
        R                  " X}5      U	R                  5      $ )
a_  Generate a mostly low rank matrix with bell-shaped singular values.

Most of the variance can be explained by a bell-shaped curve of width
effective_rank: the low rank part of the singular values profile is::

    (1 - tail_strength) * exp(-1.0 * (i / effective_rank) ** 2)

The remaining singular values' tail is fat, decreasing as::

    tail_strength * exp(-0.1 * i / effective_rank).

The low rank part of the profile can be considered the structured
signal part of the data while the tail can be considered the noisy
part of the data that cannot be summarized by a low number of linear
components (singular vectors).

This kind of singular profiles is often seen in practice, for instance:
 - gray level pictures of faces
 - TF-IDF vectors of text documents crawled from the web

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

n_features : int, default=100
    The number of features.

effective_rank : int, default=10
    The approximate number of singular vectors required to explain most of
    the data by linear combinations.

tail_strength : float, default=0.5
    The relative importance of the fat noisy tail of the singular values
    profile. The value should be between 0 and 1.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The matrix.

Examples
--------
>>> from numpy.linalg import svd
>>> from sklearn.datasets import make_low_rank_matrix
>>> X = make_low_rank_matrix(
...     n_samples=50,
...     n_features=25,
...     effective_rank=5,
...     tail_strength=0.01,
...     random_state=0,
... )
>>> X.shape
(50, 25)
r   economicF)modecheck_finiterB   r*   r   r   g)r   r   r   qrr[   r   r_   r   expidentityr]   r   )r)   r-   r   r   r   rc   rr   ur   vsingular_indlow_ranktailss                 r'   r   r     s    ` #<0II"A 99!!	~!6DA
 99!!
!7DA 99Qbjj1L M!RVVDL4QVW3W,W%XXH266$"5"FGGD
A(/*A66"&&,$$r(   )r)   n_componentsr-   n_nonzero_coefsr   c                   [        U5      nUR                  X!4S9nU[        R                  " [        R                  " US-  SS95      -  n[        R
                  " X45      n[        U 5       HB  n[        R                  " U5      n	UR                  U	5        U	SU n	UR                  US9XyU4'   MD     [        R                  " Xg5      n
U
R                  UR                  UR                  pvn
[        [        R                  XU45      $ )a&  Generate a signal as a sparse combination of dictionary elements.

Returns matrices `Y`, `D` and `X` such that `Y = XD` where `X` is of shape
`(n_samples, n_components)`, `D` is of shape `(n_components, n_features)`, and
each row of `X` has exactly `n_nonzero_coefs` non-zero elements.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int
    Number of samples to generate.

n_components : int
    Number of components in the dictionary.

n_features : int
    Number of features of the dataset to generate.

n_nonzero_coefs : int
    Number of active (non-zero) coefficients in each sample.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
data : ndarray of shape (n_samples, n_features)
    The encoded signal (Y).

dictionary : ndarray of shape (n_components, n_features)
    The dictionary with normalized components (D).

code : ndarray of shape (n_samples, n_components)
    The sparse code such that each column of this matrix has exactly
    n_nonzero_coefs non-zero items (X).

Examples
--------
>>> from sklearn.datasets import make_sparse_coded_signal
>>> data, dictionary, code = make_sparse_coded_signal(
...     n_samples=50,
...     n_components=100,
...     n_features=10,
...     n_nonzero_coefs=4,
...     random_state=0
... )
>>> data.shape
(50, 10)
>>> dictionary.shape
(100, 10)
>>> code.shape
(50, 100)
r   r   r   r   N)r   r[   r   sqrtrT   rX   rV   r_   r   r]   r   mapr   )r)   r  r-   r  r   rc   DrL   rj   idxr   s              r'   make_sparse_coded_signalr	    s    T #<0I 	!!
'A!BAAQ'	((A 	,*+A9ii%#"?#--?-Cq&		  	qA cc133!ArzzA!9%%r(   )r)   r-   r   c                    [        U5      nUR                  SSX4S9nUR                  USS2S4   SUSS2S4   -  -   SUSS2S4   -  -
  SUSS2S4   -  -
  [        R                  " U 5      S9nXE4$ )	a  Generate a random regression problem with sparse uncorrelated design.

This dataset is described in Celeux et al [1]. as::

    X ~ N(0, 1)
    y(X) = X[:, 0] + 2 * X[:, 1] - 2 * X[:, 2] - 1.5 * X[:, 3]

Only the first 4 features are informative. The remaining features are
useless.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of samples.

n_features : int, default=10
    The number of features.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The input samples.

y : ndarray of shape (n_samples,)
    The output values.

References
----------
.. [1] G. Celeux, M. El Anbari, J.-M. Marin, C. P. Robert,
       "Regularization in regression: comparing Bayesian and frequentist
       methods in a poorly informative situation", 2009.

Examples
--------
>>> from sklearn.datasets import make_sparse_uncorrelated
>>> X, y = make_sparse_uncorrelated(random_state=0)
>>> X.shape
(100, 10)
>>> y.shape
(100,)
r   r*   r   Nr         ?r   )r   r;   )r   r   r   r   )r)   r-   r   rc   rL   rM   s         r'   make_sparse_uncorrelatedr  R  s    r #<0IQay.EFAq!tWq1QT7{"Q1a4[031a4=@ggi  	 	A
 4Kr(   )n_dimr   c                J   [        U5      nUR                  X 4S9n[        R                  " [        R
                  " UR                  U5      SS9u  pEn[        R
                  " [        R
                  " US[        R                  " UR                  U S95      -   5      U5      nU$ )a  Generate a random symmetric, positive-definite matrix.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_dim : int
    The matrix dimension.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_dim, n_dim)
    The random symmetric, positive-definite matrix.

See Also
--------
make_sparse_spd_matrix: Generate a sparse symmetric definite positive matrix.

Examples
--------
>>> from sklearn.datasets import make_spd_matrix
>>> make_spd_matrix(n_dim=2, random_state=42)
array([[2.093, 0.346],
       [0.346, 0.218]])
r   F)r   r?   )r   rZ   r   svdr   r]   r   diag)r  r   rc   rp   Ur   VtrL   s           r'   make_spd_matrixr    s    L #<0I~.Azz"&&a.u=HA"
rvvarwwy'8'8e'8'DEEFKAHr(   >   bsrcoocsccsrdiadoklil)r  alpha	norm_diagsmallest_coeflargest_coefsparse_formatr   gffffff?g?g?)r  r  r  r  r  r   c                  ^^^ [        T5      m[        R                  " U 5      * n[        R                  " U U SU-
  UUU4S jTS9n[        R                  " USSS9nTR                  U 5      n	X   R                  U	   nXx-  nUR                  U-  n
U(       aB  [        R                  " S[        R                  " U
R                  5       5      -  5      nX-  U-  n
Uc  U
R                  5       $ U
R                  U5      $ )ax  Generate a sparse symmetric definite positive matrix.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_dim : int, default=1
    The size of the random matrix to generate.

    .. versionchanged:: 1.4
        Renamed from ``dim`` to ``n_dim``.

alpha : float, default=0.95
    The probability that a coefficient is zero (see notes). Larger values
    enforce more sparsity. The value should be in the range 0 and 1.

norm_diag : bool, default=False
    Whether to normalize the output matrix to make the leading diagonal
    elements all 1.

smallest_coef : float, default=0.1
    The value of the smallest coefficient between 0 and 1.

largest_coef : float, default=0.9
    The value of the largest coefficient between 0 and 1.

sparse_format : str, default=None
    String representing the output sparse format, such as 'csc', 'csr', etc.
    If ``None``, return a dense numpy ndarray.

    .. versionadded:: 1.4

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
prec : ndarray or sparse matrix of shape (dim, dim)
    The generated matrix. If ``sparse_format=None``, this would be an ndarray.
    Otherwise, this will be a sparse matrix of the specified format.

See Also
--------
make_spd_matrix : Generate a random symmetric, positive-definite matrix.

Notes
-----
The sparsity is actually imposed on the cholesky factor of the matrix.
Thus alpha does not translate directly into the filling fraction of
the matrix itself.

Examples
--------
>>> from sklearn.datasets import make_sparse_spd_matrix
>>> make_sparse_spd_matrix(n_dim=4, norm_diag=False, random_state=42)
array([[1., 0., 0., 0.],
       [0., 1., 0., 0.],
       [0., 0., 1., 0.],
       [0., 0., 0., 1.]])
r*   c                 &   > TR                  TTU S9$ )N)lowhighr   )rZ   )xr  r   r  s    r'   <lambda>(make_sparse_spd_matrix.<locals>.<lambda>#  s    <//Lq 0 
r(   )mrr   densitydata_rvsr   r   r  )rh   rP   r?   )r   r   eyerE   trilpermutationr   diagsr   r  diagonalr   asformat)r  r  r  r  r  r  r   cholauxr,  precds      `` `     r'   make_sparse_spd_matrixr4    s    n &l3LFF5M>D
))

E	
 "C ''#E
*C **51K



[
)CKD66D=DHHS2774==?334x!|||~}}]++r(   )r)   r   r   hole)r   r   r5  c          
      Z   [        U5      nU(       d<  S[        R                  -  SSUR                  U S9-  -   -  nSUR                  U S9-  nO[        R                  " [        S5       VVs/ s H1  n[        S5        H  n[        R                  SU-   -  US-  /PM      M3     snn5      n	[        R                  " U	SS	S
9n	UR                  SU 5      n
UR                  SU 4S9[        R                  " [        R                  /S//5      -  nX   R                  U-   u  pVU[        R                  " U5      -  nU[        R                  " U5      -  n[        R                  " XU45      nXUR                  SU 4S9-  -  nUR                  n[        R                  " U5      nX4$ s  snnf )a  Generate a swiss roll dataset.

Read more in the :ref:`User Guide <sample_generators>`.

Adapted with permission from Stephen Marsland's code [1].

Parameters
----------
n_samples : int, default=100
    The number of sample points on the Swiss Roll.

noise : float, default=0.0
    The standard deviation of the gaussian noise.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

hole : bool, default=False
    If True generates the swiss roll with hole dataset.

Returns
-------
X : ndarray of shape (n_samples, 3)
    The points.

t : ndarray of shape (n_samples,)
    The univariate position of the sample according to the main dimension
    of the points in the manifold.

Notes
-----
The algorithm is from Marsland [1].

References
----------
.. [1] S. Marsland, "Machine Learning: An Algorithmic Perspective", 2nd edition,
       Chapter 6, 2014.
       https://homepages.ecs.vuw.ac.nz/~marslast/Code/Ch6/lle.py

Examples
--------
>>> from sklearn.datasets import make_swiss_roll
>>> X, t = make_swiss_roll(noise=0.05, random_state=0)
>>> X.shape
(100, 3)
>>> t.shape
(100,)
r  r*   r   r      r      r   r   r      )r   r   r   rZ   r   rV   deletechoicer   r   r   r   r[   r   )r)   r   r   r5  rc   trM   rj   jcornerscorner_indexrJ   r$  zrL   s                  r'   make_swiss_rollrA  =  s   x #<0I"%%K1q9#4#4)#4#DDDE""	"22((16qLA58abeesQwQ'8'L
 ))GQQ/ ''95&&Q	N&;bhhRSQT~>VV
$&&3	BFF1IA	BFF1IA
		1)A**I*?	??A	A


1A4K Ms   -8F'
c                   [        U5      nS[        R                  -  UR                  SU 4S9S-
  -  n[        R                  " U S4[        R
                  S9n[        R                  " U5      USS2S4'   SUR                  U S9-  USS2S4'   [        R                  " U5      [        R                  " U5      S-
  -  USS2S	4'   XQUR                  SU 4S9R                  -  -  n[        R                  " U5      nXT4$ )
ai  Generate an S curve dataset.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
n_samples : int, default=100
    The number of sample points on the S curve.

noise : float, default=0.0
    The standard deviation of the gaussian noise.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, 3)
    The points.

t : ndarray of shape (n_samples,)
    The univariate position of the sample according
    to the main dimension of the points in the manifold.

Examples
--------
>>> from sklearn.datasets import make_s_curve
>>> X, t = make_s_curve(noise=0.05, random_state=0)
>>> X.shape
(100, 3)
>>> t.shape
(100,)
r   r*   r   rD   r   Nr   r   r   )r   r   r   rZ   r   r   r   signr   r[   r   r   )r)   r   r   rc   r<  rL   s         r'   make_s_curverD    s    X #<0I	BEE	Y&&Q	N&;cABA
	1~RZZ8AffQiAadGI%%9%55AadGggajBFF1IM*AadG**I*?AA	AAA


1A4Kr(   )meancovr)   r-   r1   r   r   r   c           	      r   X$:  a  [        S5      e[        U5      nU c  [        R                  " U5      n O[        R                  " U 5      n UR                  X[        R                  " U5      -  U45      n[        R                  " [        R                  " X[        R                  SS24   -
  S-  SS95      n	XSS24   nX$-  n
[        R                  " [        R                  " [        R                  " U5      U
5      [        R                  " US-
  X*U-  -
  5      /5      nU(       a  [        XUS9u  pX4$ )a2  Generate isotropic Gaussian and label samples by quantile.

This classification dataset is constructed by taking a multi-dimensional
standard normal distribution and defining classes separated by nested
concentric multi-dimensional spheres such that roughly equal numbers of
samples are in each class (quantiles of the :math:`\chi^2` distribution).

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
mean : array-like of shape (n_features,), default=None
    The mean of the multi-dimensional normal distribution.
    If None then use the origin (0, 0, ...).

cov : float, default=1.0
    The covariance matrix will be this value times the unit matrix. This
    dataset only produces symmetric normal distributions.

n_samples : int, default=100
    The total number of points equally divided among classes.

n_features : int, default=2
    The number of features for each sample.

n_classes : int, default=3
    The number of classes.

shuffle : bool, default=True
    Shuffle the samples.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape (n_samples, n_features)
    The generated samples.

y : ndarray of shape (n_samples,)
    The integer labels for quantile membership of each sample.

Notes
-----
The dataset is from Zhu et al [1].

References
----------
.. [1] J. Zhu, H. Zou, S. Rosset, T. Hastie, "Multi-class AdaBoost", 2009.

Examples
--------
>>> from sklearn.datasets import make_gaussian_quantiles
>>> X, y = make_gaussian_quantiles(random_state=42)
>>> X.shape
(100, 2)
>>> y.shape
(100,)
>>> list(y[:5])
[np.int64(2), np.int64(0), np.int64(1), np.int64(0), np.int64(2)]
z$n_samples must be at least n_classesNr   r*   r   r   )rN   r   r   rX   r   multivariate_normalr   argsortrT   newaxisr   repeatr_   r`   )rE  rF  r)   r-   r1   r   r   rc   rL   r  steprM   s               r'   make_gaussian_quantilesrM    s   j ?@@"<0I|xx
#xx~ 	%%d"++j2I,II<XA **RVVQbjj!m!44:C
DC	q&	A !D
		IIbii	*D1IIi!mY	1A%AB	
	A Ay94Kr(   c                     [        U5      nU R                  u  p4UR                  U5      nUR                  U5      nX   S S 2U4   nXuU4$ N)r   r   r,  )datar   rc   n_rowsn_colsrow_idxcol_idxresults           r'   _shufflerV  A  sR    "<0IZZNF##F+G##F+G]1g:&FG##r(   )r   rg   r   minvalmaxvalr   r   )r   rW  rX  r   r   c          
         [        U5      nU u  pUR                  X4U5      n
UR                  U[        R                  " SU-  U5      5      nUR                  U	[        R                  " SU-  U5      5      n[        R
                  " [        [        U5      U5       VVs/ s H  u  p[        R                  " X5      PM     snn5      n[        R
                  " [        [        U5      U5       VVs/ s H  u  p[        R                  " X5      PM     snn5      n[        R                  " U [        R                  S9n[        U5       H0  n[        R                  " UU:H  UU:H  5      nUU==   U
U   -  ss'   M2     US:  a  UUR                  UUR                  S9-  nU(       a  [        UU5      u  nnnUU   nUU   n[        R                  " [        U5       Vs/ s H  nUU:H  PM
     sn5      n[        R                  " [        U5       Vs/ s H  nUU:H  PM
     sn5      nUUU4$ s  snnf s  snnf s  snf s  snf )a  Generate a constant block diagonal structure array for biclustering.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
shape : tuple of shape (n_rows, n_cols)
    The shape of the result.

n_clusters : int
    The number of biclusters.

noise : float, default=0.0
    The standard deviation of the gaussian noise.

minval : float, default=10
    Minimum value of a bicluster.

maxval : float, default=100
    Maximum value of a bicluster.

shuffle : bool, default=True
    Shuffle the samples.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape `shape`
    The generated array.

rows : ndarray of shape (n_clusters, X.shape[0])
    The indicators for cluster membership of each row.

cols : ndarray of shape (n_clusters, X.shape[1])
    The indicators for cluster membership of each column.

See Also
--------
make_checkerboard: Generate an array with block checkerboard structure for
    biclustering.

References
----------

.. [1] Dhillon, I. S. (2001, August). Co-clustering documents and
    words using bipartite spectral graph partitioning. In Proceedings
    of the seventh ACM SIGKDD international conference on Knowledge
    discovery and data mining (pp. 269-274). ACM.

Examples
--------
>>> from sklearn.datasets import make_biclusters
>>> data, rows, cols = make_biclusters(
...     shape=(10, 20), n_clusters=2, random_state=42
... )
>>> data.shape
(10, 20)
>>> rows.shape
(2, 10)
>>> cols.shape
(2, 20)
r?   rB   r   r   )r   rZ   multinomialr   rK  r   r   rV   rX   r   outerr   r   rV  r   )r   rg   r   rW  rX  r   r   rc   rQ  rR  consts	row_sizes	col_sizesvalrep
row_labels
col_labelsrU  rj   selectorrS  rT  r   rowscolss                            r'   make_biclustersrf  J  s   p #<0INFvz:F %%fbiij8H*.UVI%%fbiij8H*.UVI-0z1BI-NO-N3	-NOJ -0z1BI-NO-N3	-NOJ XXe2::.F:88J!OZ1_=xF1I%  qy)""V\\"BB#+FL#A (
(
99uZ/@A/@!jAo/@ABD99uZ/@A/@!jAo/@ABD4- 	P 	P  BAs   "H+
0"H1
H7H<c          
      $   [        U5      n[        US5      (       a  Uu  pOU=pU u  pUR                  U
[        R                  " SU-  U5      5      nUR                  U[        R                  " SU	-  U	5      5      n[        R
                  " [        [        U5      U5       VVs/ s H  u  p[        R                  " X5      PM     snn5      n[        R
                  " [        [        U	5      U5       VVs/ s H  u  p[        R                  " X5      PM     snn5      n[        R                  " U [        R                  S9n[        U5       HN  n[        U	5       H<  n[        R                  " UU:H  UU:H  5      nUU==   UR                  X45      -  ss'   M>     MP     US:  a  UUR                  UUR                  S9-  nU(       a  [        UU5      u  nnnUU   nUU   n[        R                  " [        U5       VVs/ s H  n[        U	5        H  nUU:H  PM
     M     snn5      n[        R                  " [        U5       VVs/ s H  n[        U	5        H  nUU:H  PM
     M     snn5      nUUU4$ s  snnf s  snnf s  snnf s  snnf )a,  Generate an array with block checkerboard structure for biclustering.

Read more in the :ref:`User Guide <sample_generators>`.

Parameters
----------
shape : tuple of shape (n_rows, n_cols)
    The shape of the result.

n_clusters : int or array-like or shape (n_row_clusters, n_column_clusters)
    The number of row and column clusters.

noise : float, default=0.0
    The standard deviation of the gaussian noise.

minval : float, default=10
    Minimum value of a bicluster.

maxval : float, default=100
    Maximum value of a bicluster.

shuffle : bool, default=True
    Shuffle the samples.

random_state : int, RandomState instance or None, default=None
    Determines random number generation for dataset creation. Pass an int
    for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

Returns
-------
X : ndarray of shape `shape`
    The generated array.

rows : ndarray of shape (n_clusters, X.shape[0])
    The indicators for cluster membership of each row.

cols : ndarray of shape (n_clusters, X.shape[1])
    The indicators for cluster membership of each column.

See Also
--------
make_biclusters : Generate an array with constant block diagonal structure
    for biclustering.

References
----------
.. [1] Kluger, Y., Basri, R., Chang, J. T., & Gerstein, M. (2003).
    Spectral biclustering of microarray data: coclustering genes
    and conditions. Genome research, 13(4), 703-716.

Examples
--------
>>> from sklearn.datasets import make_checkerboard
>>> data, rows, columns = make_checkerboard(shape=(300, 300), n_clusters=10,
...                                         random_state=42)
>>> data.shape
(300, 300)
>>> rows.shape
(100, 300)
>>> columns.shape
(100, 300)
>>> print(rows[0][:5], columns[0][:5])
[False False False  True False] [False False False False False]
r   r?   rB   r   r   )r   r   rZ  r   rK  r   r   rV   rX   r   r[  rZ   r   r   rV  r   )r   rg   r   rW  rX  r   r   rc   n_row_clustersn_col_clustersrQ  rR  r]  r^  r_  r`  ra  rb  rU  rj   r=  rc  rS  rT  labelr   rd  re  s                               r'   make_checkerboardrk    sg   n #<0Iz9%%)3&*44 NF%%		#.?I %%		#.?I -0~1F	-RS-R3	-RSJ -0~1F	-RS-R3	-RSJ XXe2::.F>"~&Axx
aqAH8	 1 1& AA ' #
 qy)""V\\"BB#+FL#A (
(
99 ~.	
.>* %*  .	
D 99 >*	
*~. %.  *	
D 4G 	T 	T$	
	
s   %"I:
7"J 
"J
"J
)r>   r   )i.  )r>   r>   )r>   )r>   r   )r>   r   )r*   rO  )4rb   r   r   collections.abcr   r   r   numpyr   scipy.sparsery   r   scipyr   sklearn.utilsr   preprocessingr	   utilsr
   r   r   r`   utils._param_validationr   r   r   utils.randomr   r   ra   r   r   r   tupler   r   r   r   r   r   r   r	  r  r  r4  rA  rD  rM  rV  rf  rk   r(   r'   <module>rw     s;     $ "     / 3 + K K 5  hxD@Ax!T&AB 	(8QVDE 	1d6BC	
 	x!T&AB 	hxD@A 	(AtF!K L 	L$' 	8D!Qv67 	htQY?@ 	i[ 	(4tI>dS 	(4D;\4P 	I; 	(  	yk!$ #'', @ 

#@+*@F
 xD@A!T&ABxD@Ah4?@Haf=>%;+'((;<iH!*'( #'  d ddN xD@A'( #'8d 88v xD@A!T&AB"8QVDExD@A$d9=>#HafEtL"4Af=>4D89;'( #'" R 	
	R! Rj xD@%H;4D8$?'(D!Qv67 #'	 T"$T#T	Tn xD@%H;4D8$?'(	 #'KT KK\ xD@,O!T&ABXq$v>dS q$v>Mg;'($+	 #' d ddN xD@A!T&AB4d6:;'(	 #'H#D HHV xD@A4D89'(
 #'I3T IIX xD@A4D89'(
 #'I3T IIX xD@A!T&AB#HafEF"4Af=>'( #'	 ]% ]%	]%@ xD@A!(AtFCD!T&AB$Xq$vFG'( #'	  T&	T&n xD@A!T&AB'(
 #'94 99x 8QV<='( #' ,0 %%P 8QV<=4Af56["4Af=>!$1V<=HI
 (( #'  f, f,f,R xD@A4D89'(	 #'ICd IIX xD@A4D89'(
 #'.4 ..b t$q$v67xD@A!T&ABxD@A;'( #' 
ggT$ !T&AB4D89D$Y?@D$Y?@;'( #'  kk\ !T&A<P4D89D$Y?@D$Y?@;'( #'  r(   