
    -i&]              
          S SK r S SKJr  S SKJr  S SKrS SKrS SKJ	r
  S SKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  S SKJ r J!r!J"r"J#r#J$r$  S SK%J&r&  S r'S r(S	 r)\RT                  RW                  S
/ \,S4/ SQ\,S4\RZ                  " / 5      \,S4\RZ                  " / SQ5      \,S4\R\                  R]                  S5      \,S4/5      S 5       r/\RT                  RW                  S0 SSS./5      S 5       r0S r1S r2S r3S r4S r5S r6S r7S r8S r9\RT                  RW                  S/ SQ\RZ                  " / SQ5      \:" / SQ5      /5      S 5       r;S r<S r=S  r>S! r?S" r@S# rAS$ rBS% rCS& rD\RT                  RW                  S'S(S)/5      \RT                  RW                  S*/ S+Q5      S, 5       5       rE\RT                  RW                  S-S)S(/5      S. 5       rFS/ rGS0 rHS1 rIS2 rJS3 rKS4 rLS5 rMg)6    N)defaultdict)partial)make_biclusters
make_blobsmake_checkerboardmake_circlesmake_classificationmake_friedman1make_friedman2make_friedman3make_hastie_10_2make_low_rank_matrix
make_moonsmake_multilabel_classificationmake_regressionmake_s_curvemake_sparse_coded_signalmake_sparse_spd_matrixmake_sparse_uncorrelatedmake_spd_matrixmake_swiss_roll)assert_allcloseassert_allclose_dense_sparseassert_almost_equalassert_array_almost_equalassert_array_equal)assert_all_finitec                  4   SS/n [        SSSSSSSSS S U S	S
9u  pU SS/:X  d   eUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        R                  " U5      R                  S:X  d   S5       e[	        US	:H  5      S:X  d   S5       e[	        US:H  5      S:X  d   S5       e[	        US:H  5      S:X  d   S5       e[        SSSS	S	SSS	S9u  pUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        R                  " UR                  SUR                  4/UR                  S   -  5      5      R                  UR                  5      R                  S UR                  S   5      R                  S	   S:X  d   S!5       eg )"N皙?      ?d               Fr   )	n_samples
n_featuresn_informativen_redundant
n_repeated	n_classesn_clusters_per_class	hypercubeshiftscaleweightsrandom_stater!   r"   X shape mismatchr!   y shape mismatchr%   Unexpected number of classes
   z(Unexpected number of samples in class #0   z(Unexpected number of samples in class #1   A   z(Unexpected number of samples in class #2     T      ?)r&   r'   r(   r)   r*   r-   r/   r1   )r<   r=   )r<    z Unexpected number of unique rows)r	   shapenpuniquesumviewdtypereshape)r0   Xys      `/var/www/html/venv/lib/python3.13/site-packages/sklearn/datasets/tests/test_samples_generator.pytest_make_classificationrK   (   s   DkGDA sDk!!!77i3!3377f00099Q<%E'EE%qAv;"HHHqAv;"HHHqAv;"HHH 	DA 77j 4"44 77g111
		!&&2qww-1771:567	agg	QWWQZ	 	q	 		* **	    c                  R   Sn [        [        U SSSSSSS9nSS/S4SS/S-  S4SS	/S
-  S4SS/S-  S4SSS	/S4SS/S-  S4SS/S44 GHM  u  p#n[        U5      nXT-  nUS-  nS GH+  nU" UUUUUUUSS9u  pU	R                  Xr4:X  d   eU
R                  U4:X  d   e[        R
                  " U	5      nUR                  SR                  UR                  S   5      S9R                  5       n[        R                  " USS9u  p[        U5      U:X  d   S5       e[        [        5      n[        X5       H  u  nnUU   R                  U5        M     UR                  5        H  n[        U5      U:X  a  M   S5       e   [        U5      U:X  d   S5       e[!        [        R"                  " U
5      [        U
5      -  U-  S/U-  SS9  [%        [        U5      5       H  nXU:H     R'                  SS9nU(       a9  [!        [        R(                  " U5      U -  [        R*                  " U5      SSS9  MW  [,        R.                  " [0        5         [!        [        R(                  " U5      U -  [        R*                  " U5      SSS9  S S S 5        M     GM.     GMP     [,        R.                  " [2        5         U" SSSSS!9  S S S 5        [,        R.                  " [2        5         U" SSSSS!9  S S S 5        g ! , (       d  f       GM(  = f! , (       d  f       NN= f! , (       d  f       g = f)"zTest the construction of informative features in make_classification

Also tests `n_clusters_per_class`, `n_classes`, `hypercube` and
fully-specified `weights`.
g    .Ar   r$   F)	class_sepr)   r*   flip_yr.   r/   shuffler:   gUUUUUU?r%   r       r>         ?r8   @   2   )FT)r&   r+   r0   r'   r(   r,   r-   r1   z|S{0})rF   T)return_inversez6Wrong number of clusters, or not in distinct quadrantsz"Wrong number of clusters per classzWrong number of classesz!Wrong number of samples per classerr_msgaxisr#   z/Clusters are not centered on hypercube vertices)decimalrW   z5Clusters should not be centered on hypercube verticesN)r'   r(   r+   r,   )r   r	   lenrA   rB   signrE   formatstridesravelrC   r   setzipaddvaluesr   bincountrangemeanabsonespytestraisesAssertionError
ValueError)rN   maker(   r0   r,   r+   
n_clustersr&   r-   rH   rI   signsunique_signscluster_indexclusters_by_classclusterclsclusterscentroids                      rJ   -test_make_classification_informative_featuresrw   X   s,    I	D 
QC	
UGaK	
UGaK	
UGaK	
UENA	eWq["	aS!94 4 L	5
O	&I##(+%9#	DA 77y888877yl*** GGAJEJJW^^EMM!4D%EJFLLNE*,))E$*O'L|$
2 H2 !,C 0 #M 5!#&**73 !6-4468}(<< 8< 7 ()Y6Q8QQ6%AQ'72i; !\!23g56;;;C-x(94. ! Q	  ~61FF8,y8GGM2$% W 76 4Q '9R 
z	"aaP 
#	z	"aaP 
#	" 76 
#	"	"	"s$   8K4	5
L!
L4
L
L
L&c                    ^ 0 SS_SS_SS_SS_S	S_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_n [        S'0 U D6u  pSU S'   [        S'0 U D6m[        TS5      (       aD  [        TS5      (       a3  [        TS 5      (       a"  [        TS!5      (       a  [        TS"5      (       d   eU4S# jn[        R                  " UTR                  5      (       d   e[        R                  " UTR
                  5      (       d   eTR                  [         R                  :X  d   eTR                  U :X  d   eU" S$5      U S   :X  d   eU" S%5      U S   :X  d   eU" S&5      U S	   :X  d   eg)(zm
Test that make_classification returns a Bunch when return_X_y is False.

Also that bunch.X is the same as X
r&   r!   r'   r"   r(   r#   r)   r$   r*   r+   r%   r,   r:   r0   NrO   {Gz?rN         ?r-   Tr.           r/   rP   r1   *   
return_X_yFDESCR
parametersfeature_inforH   rI   c                 :   > TR                   R                  U 5      $ )N)r   count)str_bunchs    rJ   r   2test_make_classification_return_x_y.<locals>.count   s    !!''--rL   informative	redundantrepeated )	r	   hasattrrB   array_equalrH   rI   r~   __doc__r   )kwargsrH   rI   r   r   s       @rJ   #test_make_classification_return_x_yr      s   Sb 	 	q	
 	a 	Q 	 	4 	$ 	S 	T 	 	 	4 	  	d!F& ((DA F<)&)E 	wE<((E>**E3E3	 . >>!UWW%%%%>>!UWW%%%%;;-55555v%%%6/#::::!6666| 4444rL   zweights, err_type, err_msgz:Weights specified but incompatible with number of classes.)r    rR   r   r%   c                 r    [         R                  " XS9   [        U S9  S S S 5        g ! , (       d  f       g = f)Nmatch)r0   )ri   rj   r	   )r0   err_typerW   s      rJ   %test_make_classification_weights_typer      s$    6 
x	/G, 
0	/	/s   
(
6r   )r+   r(   c                     [        SSS/SS.U D6u  p[        S[        R                  " SS/5      SS.U D6u  p4[        X5        [        X$5        g )Nr   g?r   )r0   r1   r   )r	   rB   arrayr   )r   X1y1X2y2s        rJ   1test_make_classification_weights_array_or_list_okr     sP     N#s!NvNFB X3*)=AXQWXFBrL   c            
         [        SS5       H  u  p[        SSSSSU S9u  p#UR                  S	:X  d   S
5       eU (       d+  [        U Vs/ s H  n[        U5      PM     sn5      S:X  d   e[	        U Vs/ s H  n[        U5      PM     sn5      U:X  d   e[        U Vs/ s H  n[        U5      PM     sn5      S::  a  M   e   g s  snf s  snf s  snf )NTFr   r$   r!   r"   r%   r   Fr&   r'   r+   r1   return_indicatorallow_unlabeledr2   r3   r:   )ra   r   rA   maxminr[   )r   
min_lengthrH   YrI   s        rJ   4test_make_multilabel_classification_return_sequencesr     s    '*=&'A#-"+
 ww)#7%77#*1A*+q000A&AqCFA&':555A&AqCFA&'1,,, (B +&&s   	C
4C
C
c            	         [        SS5       Hu  u  p[        SSSSU S9u  p#UR                  S:X  d   S	5       eUR                  S
:X  d   S5       e[        R                  " [        R
                  " USS9U:  5      (       a  Mu   e   [        SSSSW SS9u  pEpg[        WU5        [        WU5        UR                  S:X  d   e[        UR                  5       S5        UR                  S:X  d   e[        UR                  SS9S/S-  5        g )Nr   r   r9   r"   r%   r   )r&   r'   r+   r1   r   r9   r"   r3   r9   r%   Y shape mismatchrX   T)r&   r'   r+   r1   r   return_distributionsr6   r$   )r"   r%   )	ra   r   rA   rB   allrD   r   r   r   )r   r   rH   r   r   Y2p_cp_w_cs           rJ   4test_make_multilabel_classification_return_indicatorr   &  s   '*=&'A#-+
 ww("6$66"ww'!5#55!vvbffQQ'*45555 (B 8'!BC a$q"99	1%;;'!!!		q	)A373rL   c            
          [        SS5       H`  u  p[        SSSSSU S9u  p#UR                  S	:X  d   S
5       eUR                  S:X  d   S5       e[        R                  " U5      (       a  M`   e   g )Nr   r   r9   r"   r%   r   sparser   r   r3   r   r   )ra   r   rA   spissparse)r   r   rH   r   s       rJ   ;test_make_multilabel_classification_return_indicator_sparser   E  sy    '*=&'A#-%+
 ww("6$66"ww'!5#55!{{1~~~ (BrL   c                      [        SSS9u  pU R                  S:X  d   S5       eUR                  S:X  d   S5       e[        R                  " U5      R                  S:X  d   S	5       eg )
Nr!   r   )r&   r1   r!   r8   r3   r4   r5   )r:   r7   )r   rA   rB   rC   rH   rI   s     rJ   test_make_hastie_10_2r   T  sb    c:DA77i3!3377f00099Q<%E'EE%rL   c                    [        SSSSSSSU S9u  pnUR                  S	:X  d   S
5       eUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        US:g  5      S:X  d   S5       e[        [        R
                  " U[        R                  " X5      -
  5      SSS9  [        SSS9u  pUR                  S:X  d   eg )N   r8   r%   r#   Tr{   rz   )r&   r'   r(   effective_rankcoefbiasnoiser1   )r   r8   r3   )r   r5   r8   coef shape mismatch)Unexpected number of informative featuresr$   rZ   r!   )r&   r'   )r!   r$   )r   rA   rD   r   rB   stddotglobal_random_seedrH   rI   cs       rJ   test_make_regressionr   [  s    '	GA! 77i3!3377f00077e222qCx=AJJJ q266!</0#qA SQ7DA77hrL   c           
      P   [        SSSSSSU S9u  pnUR                  S:X  d   S5       eUR                  S	:X  d   S
5       eUR                  S:X  d   S5       e[        [        US:g  5      SS5        [	        [
        R                  " U[
        R                  " X5      -
  5      SSS9  g )Nr!   r8   r%   Trz   )r&   r'   r(   	n_targetsr   r   r1   r   r3   )r!   r%   r5   )r8   r%   r   r{   r   r$   r   )r   rA   r   rD   r   rB   r   r   r   s       rJ    test_make_regression_multitargetr   t  s    'GA! 77i3!3377h2 2277g444s18}a)TU q266!</0#qArL   c                    [         R                  " / SQ5      n[         R                  " SS/SS/SS//5      n[        U SSUUS9u  p4UR                  S:X  d   S5       eUR                  S	:X  d   S
5       e[         R                  " U5      R                  S:X  d   S5       e[        [        X!5      5       H,  u  nu  pg[        X4U:H     U-
  R                  5       USS5        M.     g )Ng?g?g?r{   rz   rT   r:   )r1   r&   r'   centerscluster_std)rT   r:   r3   )rT   r5   r6   zUnexpected number of blobsr$   Unexpected std)	rB   r   r   rA   rC   	enumeratera   r   r   )r   cluster_stdscluster_centersrH   rI   ictrr   s           rJ   test_make_blobsr     s    88,-Lhhc
S#Jc
CDO' DA 77g11177e///99Q<%C'CC%"3#EF:CQAvY_113S!=MN GrL   c                      / SQn [        U SSS9u  pUR                  [        U 5      S4:X  d   S5       e[        [        R
                  " U[        U 5      S9U :H  5      (       d   S5       eg )N)rT      r"   r:   r   r&   r'   r1   r3   	minlength$Incorrect number of samples per blobr   rA   rD   r   rB   rd   r[   )r&   rH   rI   s      rJ   test_make_blobs_n_samples_listr     sg    I	aaHDA77s9~q))=+==)r{{1I79DEE .ErL   c                    / SQn[         R                  " SS/SS/SS//5      n[         R                  " / SQ5      n[        UUUU S9u  pEUR                  [	        U5      S4:X  d   S5       e[        [         R                  " U[        U5      S9U:H  5      (       d   S	5       e[        [        X#5      5       H,  u  nu  px[        XEU:H     U-
  R                  5       US
S5        M.     g )Nr"   r"   r"   r{   rz   r   )r&   r   r   r1   r:   r3   r   r   r$   r   )rB   r   r   rA   rD   r   rd   r[   r   ra   r   r   )	r   r&   r   r   rH   rI   r   r   r   s	            rJ   +test_make_blobs_n_samples_list_with_centersr     s    Ihhc
S#Jc
;<G88,-L '	DA 77s9~q))=+==)r{{1I79DEE .E #3w#=>:CQAvY_113S!=MN ?rL   r&   )r#   r%   r   c                     S n[        XSS9u  p#UR                  [        U 5      S4:X  d   S5       e[        [        R
                  " U[        U 5      S9U :H  5      (       d   S5       eg )Nr   )r&   r   r1   r:   r3   r   r   r   )r&   r   rH   rI   s       rJ   &test_make_blobs_n_samples_centers_noner     sg     G	KDA77s9~q))=+==)r{{1I79DEE .ErL   c                  f    SS/n Sn[        XSSS9u  p#nUR                  [        U 5      U4:X  d   eg )Nr8   r"   r%   Tr   )r&   r'   return_centersr1   )r   rA   r[   )r&   r'   rH   rI   r   s        rJ   test_make_blobs_return_centersr     sC    RIJ4VWMA' ==S^Z8888rL   c                     / SQn [         R                  " SS/SS/SS//5      n[         R                  " / SQ5      n[        R                  " SU  SUS S  35      n[        R
                  " [        US9   [        XS S S	9  S S S 5        [        R                  " S
U SUS S  35      n[        R
                  " [        US9   [        XUS S S9  S S S 5        SR                  S5      n[        R
                  " [        US9   [        U SS	9  S S S 5        g ! , (       d  f       N= f! , (       d  f       N]= f! , (       d  f       g = f)Nr   r{   rz   r   zMLength of `n_samples` not consistent with number of centers. Got n_samples = z and centers = r@   r   )r   zNLength of `clusters_std` not consistent with number of centers. Got centers = z and cluster_std = )r   r   z8Parameter `centers` must be array-like. Got {!r} insteadr%   )	rB   r   reescaperi   rj   rl   r   r]   )r&   r   r   wrong_centers_msgwrong_std_msgwrong_type_msgs         rJ   test_make_blobs_errorr     s)   Ihhc
S#Jc
;<G88,-L			$+_WSb\N	D 
z):	;9crl3 
<II	 	!4\#25F4G	IM 
z	79<;LM 
8OVV	N 
z	89a( 
9	8 
<	; 
8	7
 
9	8s$   4DD&D7
D#&
D47
Ec           
      `   [        SSSU S9u  pUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        U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   -  -   5        g )Nr#   r8   r{   )r&   r'   r   r1   r#   r8   r3   r#   r5   r   r$   r"   r:   r>   r%   rQ   )r
   rA   r   rB   sinpir   rH   rI   s      rJ   test_make_friedman1r     s    #<NDA 77g11177d?...?	
RVVBEEAadGOa1g-..
!Q$#!#
#	$
qAw,	 a1g+	rL   c           
         [        SSU S9u  pUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        X!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-  5        g )Nr#   r{   r&   r   r1   r#   rQ   r3   r   r5   r   r:   r$   r%   r>   )r   rA   r   r   s      rJ   test_make_friedman2r     s    AS?QRDA77f00077d?...?	adGqLAadGa1g-Qq!tWqAw5F0GGAMMRUUrL   c                    [        SSU S9u  pUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        U[        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      5        g )Nr#   r{   r   r   r3   r   r5   r$   r:   r%   r   )r   rA   r   rB   arctanr   s      rJ   test_make_friedman3r     s    AS?QRDA77f00077d?...?	299a1g!Q$'!qAw1a4/@*AAQq!tWLMrL   c                      [        SSSSSS9n U R                  S:X  d   S5       eSS	KJn  U" U 5      u  p#n[	        U5      S-
  S
:  d   S5       eg )NrT   r9   r#   ry   r   )r&   r'   r   tail_strengthr1   )rT   r9   r3   )svdr   zX rank is not approximately 5)r   rA   numpy.linalgr   rD   )rH   r   usvs        rJ   test_make_low_rank_matrixr    sa    	A 77h2 22 !fGA!q6A:<<<rL   c                    [        SSSSU S9u  pnUR                  S:X  d   S5       eUR                  S:X  d   S	5       eUR                  S
:X  d   S5       eU H-  n[        [        R                  " U5      5      S:X  a  M(   S5       e   [        XU-  5        [        [        R                  " US-  R                  SS95      [        R                  " UR                  S   5      5        g )Nr#      r8   r%   )r&   n_componentsr'   n_nonzero_coefsr1   r   r   )r  r8   zD shape mismatch)r#   r  r3   zNon-zero coefs mismatchr:   r$   rX   r   )	r   rA   r[   rB   flatnonzeror   sqrtrD   rh   )r   r   DrH   rows        rJ   test_make_sparse_coded_signalr    s    &'GA! 77g11177g11177f0002>>#&'1,G.GG, A1uBGGQTJJAJ./1DErL   c                  z    [        SSSS9u  pU R                  S:X  d   S5       eUR                  S:X  d   S5       eg )	Nr#   r8   r   r   r   r3   r   r5   )r   rA   r   s     rJ   test_make_sparse_uncorrelatedr  .  s@    #aBQODA77g11177d?...?rL   c                     [        SU S9nUR                  S:X  d   S5       e[        XR                  5        SSKJn  U" U5      u  p4[        R                  " US:  5      (       d   S5       eg )Nr#   )n_dimr1   )r#   r#   r3   r   eigX is not positive-definite)r   rA   r   Tr   r  rB   r   )r   rH   r  eigenvalues_s        rJ   test_make_spd_matrixr  5  s`    a.@AA77f000a% VNK66+/""@$@@"rL   	norm_diagTFsparse_format)Nbsrcoocsccsrdiadoklilc                 :   Sn[        UU UUS9nUR                  X34:X  d   S5       eUc5  [        R                  " U5      (       a   e[	        XDR
                  5        UnOR[        R                  " U5      (       a  UR                  U:X  d   e[        XDR
                  5        UR                  5       nSSK	J
n  U" U5      u  px[        R                  " US:  5      (       d   S5       eU (       a/  [        UR                  5       [        R                  " U5      5        g g )Nr#   )r  r  r  r1   r3   r   r  r  )r   rA   r   r   r   r  r]   r   toarrayr   r  rB   r   r   diagonalrh   )	r  r  r   r  rH   Xarrr  r  r  s	            rJ   test_make_sparse_spd_matrixr%  A  s    
 E#'		A 77un$8&88$;;q>>!!33{{1~~!((m";;;$Q,yy{  YNK66+/""@$@@"!$--/2775>B rL   holec                    [        SSXS9u  p#UR                  S:X  d   eUR                  S:X  d   e[        US S 2S4   U[        R                  " U5      -  5        [        US S 2S4   U[        R
                  " U5      -  5        g )Nr#   r{   )r&   r   r1   r&  r#   r%   r   r   r:   )r   rA   r   rB   cosr   )r   r&  rH   ts       rJ   test_make_swiss_rollr+  c  sv    3-?DA 77f77d??a1gq266!9}5a1gq266!9}5rL   c                 J   [        SSU S9u  pUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        US S 2S4   [        R                  " U5      5        [        US S 2S	4   [        R
                  " U5      [        R                  " U5      S
-
  -  5        g )Nr#   r{   r   r(  r3   r   zt shape mismatchr   r:   r$   )r   rA   r   rB   r   r\   r)  )r   rH   r*  s      rJ   test_make_s_curver-  o  s    !3=OPDA77f00077d?...?a1grvvay1a1grwwqzRVVAY]'CDrL   c                  $   [        SSSSS9u  pnU R                  S:X  d   S5       eUR                  S:X  d   S5       eUR                  S:X  d   S	5       e[        U 5        [        U5        [        U5        [        SSSSS9u  n  n[        X5        g )
Nr!   r!   rQ   Tr   rA   rn   rP   r1   r3   )rQ   r!   rows shape mismatchcolumns shape mismatch)r   rA   r   r   )rH   rowscolsr   r  s        rJ   test_make_biclustersr5  x  s    #Q1MAT 77j 4"44 ::!8#88!::         addQ1HB1 a$rL   c                  b   [        SSSSS9u  pnU R                  S:X  d   S5       eUR                  S:X  d   S5       eUR                  S:X  d   S5       e[        SS	SSS9u  pn[        U 5        [        U5        [        U5        [        SS	SSS9u  n  n[        SS	SSS9u  n  n[        X55        g )
Nr/  )r"   r#   Tr   r0  r3   r1  r2  r:   )r   rA   r   r   )rH   r3  r4  r   r  r   s         rJ   test_make_checkerboardr7    s    %WdMAT 77j 4"44 ::#:%::#::        
 &Q1MAT add Q1HB1 !Q1HB1 b%rL   c                     [        SSU S9u  p[        X5       H3  u  p4US:X  a  SS/OSS/nX5-
  S-  R                  5       n[        USS	S
9  M5     g )Nr%   F)rP   r1   r   r{   rz   r>   r:   z$Point is not on expected unit circlerV   )r   ra   rD   r   )r   rH   rI   xlabelcenterdist_sqrs          rJ   test_make_moonsr=    s]    a5GHDAI$z#sSzZA%**,c#I	
 rL   c                  p   [        SS9u  p[        R                  " US:H  5      S:X  a  [        R                  " US:H  5      S:X  d   S5       eU R                  S:X  d   S	5       eUR                  S
:X  d   S5       e[        R
                  " [        SS9   [        SS9  S S S 5        g ! , (       d  f       g = f)N)   r#   r&   r   r?  r$   r#   z$Number of samples in a moon is wrong)   r:   r3   )rA  r5   z8`n_samples` can be either an int or a two-element tuple.r   r   )r   rB   rD   rA   ri   rj   rl   r   s     rJ   test_make_moons_unbalancedrB    s    'DA66!q&>Q266!q&>Q#6 .6 77g11177e///	I
 	U#	
 
 
s   
B''
B5c                     Sn S H  u  pn[        USS U S9u  pEUR                  US4:X  d   S5       eUR                  U4:X  d   S5       eSS/n[        XE5       H>  u  pxXv-
  S-  R                  5       n	US	:X  a  S
OU S-  n
US	:X  a  S
OU S-  n
[	        XSS9  M@     XES	:H     R                  US4:X  d   S5       eXES:H     R                  US4:X  a  M   S5       e   g )Ng333333?))r?  r%   rQ   )r  rQ   rQ   F)rP   r   factorr:   r3   r5   r{   r   rz   zPoint is not on expected circlerV   z1Samples not correctly distributed across circles.r$   )r   rA   ra   rD   r   )rD  r&   n_outern_innerrH   rI   r;  r9  r:  r<  dist_exps              rJ   test_make_circlesrH    s$   F'=#	G IuDPww9a.(<*<<(ww9,&:(::&sA	HA)..0H#qjsfaiH#qjsfaiH,M	 " ay#
 
 	? ?	? 
 ay#
 
 	? ?	? 
' (>rL   c                  ~   [        SS9u  p[        R                  " US:H  5      S:X  d   S5       e[        R                  " US:H  5      S:X  d   S5       eU R                  S	:X  d   S
5       eUR                  S:X  d   S5       e[        R
                  " [        SS9   [        SS9  S S S 5        g ! , (       d  f       g = f)N)r:   r  r@  r   r:   z*Number of samples in inner circle is wrongr$   r  z*Number of samples in outer circle is wrong)r8   r:   r3   r   r5   z7When a tuple, n_samples must have exactly two elements.r   )r   rB   rD   rA   ri   rj   rl   r   s     rJ   test_make_circles_unbalancedrJ    s    &)DA66!q&>QL LL66!q&>QL LL77g11177e///	G
 	u%	
 
 
s   
B..
B<)Nr   collectionsr   	functoolsr   numpyrB   ri   scipy.sparser   r   sklearn.datasetsr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   sklearn.utils._testingr   r   r   r   r   sklearn.utils.validationr   rK   rw   r   markparametrizerl   r   randomr   r   r   r   r   r   r   r   r   r   r   tupler   r   r   r   r   r   r  r  r  r  r%  r+  r-  r5  r7  r=  rB  rH  rJ  r   rL   rJ   <module>rV     sO   	 #         *  7-*``QF05f  	ZUVH	
 HHRLH	
 HH&'H	
 IIQH	
#4-54-
 Ba!(L#MN  O -"4>F2B(O$O& )RXXi0%	2BC9)."="F"/	A tUm4LC 5C< %/6 06E%(&6
$?8&rL   