
    >[gd                     ^   d dl Z d dlZd dlZd dlmZmZmZ d dlm	Z	m
Z
mZmZ d dlmZmZmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d Zd Z d Z!d Z"d Z#d Z$d Z%ejL                  jO                  de
eef      d        Z(ejL                  jO                  deee	f      d        Z)ejL                  jO                  deee	e
f      d        Z*d Z+ejL                  jO                  de	eee
f      ejL                  jO                  d e+             d               Z,ejL                  jO                  de
eee	f      d        Z-d Z.ejL                  jO                  dddg      d        Z/d  Z0d! Z1d" Z2d# Z3ejL                  jO                  d$eee	g      d%        Z4ejL                  jO                  d&d'd(g      ejL                  jO                  d$eee	g      d)               Z5ejL                  jO                  d*e	e
eeg      d+        Z6ejL                  jO                  d*e	e
eeg      d,        Z7d- Z8d. Z9ejL                  jO                  d*ee	e
eg      d/        Z:ejL                  jO                  d*ee	e
eg      d0        Z;ejL                  jO                  d*ee	eg      d1        Z<y)2    N)assert_allcloseassert_array_almost_equalassert_array_equal)CCAPLSSVDPLSCanonicalPLSRegression)_center_scale_xy(_get_first_singular_vectors_power_method_get_first_singular_vectors_svd_svd_flip_1d)load_linnerudmake_regression)VotingRegressor)ConvergenceWarning)LinearRegression)check_random_state)svd_flipc                     t        j                  | j                  |       }t        |t        j                  t        j                  |                   y )N)npdotTr   diag)MKs     e/var/www/html/bid-api/venv/lib/python3.12/site-packages/sklearn/cross_decomposition/tests/test_pls.pyassert_matrix_orthogonalr      s0    
qssAAa!45    c                     t               } | j                  }| j                  }t        |j                  d         }|j                  ||       t        |j                         t        |j                         t        |j                         t        |j                         |j                  }|j                  }|j                  }|j                  }t        |j                         |j                         d      \  }}	}
}}}t        |t!        j"                  ||j$                               t        |	t!        j"                  ||j$                               |j'                  |      }t        ||j                         |j'                  ||      \  }}t        ||j                         t        ||j                         |j)                  |      }t        ||       |j)                  ||      \  }}t        ||       y )N   n_componentsTscale)r   datatargetr   shapefitr   
x_weights_
y_weights_	_x_scores	_y_scoresx_loadings_y_loadings_r
   copyr   r   r   r   	transforminverse_transform)dXYplsr   PUQXcYcx_meany_meanx_stdy_stdXtYtX_back_Y_backs                      r   test_pls_canonical_basicsrD      sv   A	A	A
AGGAJ
/CGGAqMS^^,S^^,S]]+S]]+ 	AAAA+;	!&&($,(BFFE5 b"&&ACC.1b"&&ACC.1 
q	Bb#--0]]1a FBb#--0b#--0 ""2&Ffa(%%b"-IAvfa(r   c                     t               } | j                  }| j                  }t        |j                  d         }|j                  ||      \  }}t        ||j                         t        j                  g dg dg dg      }t        j                  g dg dg dg      }t        j                  g d	g d
g dg      }t        j                  g d	g d
g dg      }	t        t        j                  |j                        t        j                  |             t        t        j                  |j                        t        j                  |             t        t        j                  |j                        t        j                  |	             t        t        j                  |j                        t        j                  |             t        j                   |j                  |z        }
t        j                   |j                  |z        }t        j                   |j                  |z        }t        j                   |j                  |	z        }t        |
|       t        ||       y )Nr    r!   ),6gbx+rNF?);0g&Կf_)@mпg<-bL?ȣȿ)gHgtϿrG   )gE` gt[Wm¿rI   )ggLM3?rK   )g?g+E!?g4Ӝ@?)gsYO)?g`{?gA'?)g;Ծgпgſ)r   r%   r&   r	   r'   fit_transformr   	x_scores_r   arrayr   absr-   r)   r.   r*   sign)r2   r3   r4   r5   X_transrB   expected_x_weightsexpected_x_loadingsexpected_y_weightsexpected_y_loadingsx_loadings_sign_flipx_weights_sign_flipy_weights_sign_flipy_loadings_sign_flips                 r    test_sanity_check_pls_regressionrZ   C   s    	A	A	A
QWWQZ
0C""1a(JGQ
 GS]]+232	
 ((232	
 113	
 ((113	
 bffS__5rvv>Q7RSbffS^^4bff=O6PQbffS__5rvv>Q7RSbffS^^4bff=O6PQ 773??5H#HI''#..3E"EF''#..3E"EF773??5H#HI24GH24GHr   c                  R   t               } | j                  }| j                  }d|d d df<   t        |j                  d         }|j                  ||       t        j                  g dg dg dg      }t        j                  g dg dg d	g      }t        j                  g d
g dg dg      }t        t        j                  |      t        j                  |j                               t        t        j                  |      t        j                  |j                               t        t        j                  |j                        t        j                  |             t        t        j                  |j                        t        j                  |             t        j                  ||j                  z        }t        j                  ||j                  z        }t        j                  |dd  |j                  dd  z        }	t        ||       t        |dd  |	       y )Nr    r   r!   )g͝Og(}?:F?)gqgqdvgѿ|N<)g1, ˿g7Ƚ?\ƿ)gCgBg<&.̿r\   )gBg5_/Er]   )gQggr9?r^   )        r_   r_   )g ?gXZ?ghC%d?)gVSg{sɂϿg$(E,ǿ)r   r%   r&   r	   r'   r(   r   rN   r   rO   r)   r-   r.   r*   rP   r   )
r2   r3   r4   r5   rR   rS   rU   rV   rW   rY   s
             r   2test_sanity_check_pls_regression_constant_column_Yr`      s    	A	A	AAadG
QWWQZ
0CGGAqM021	
 ((010	
 ((--0	
 bff%78"&&:PQbff%89266#//;RSbffS__5rvv>Q7RSbffS^^4bff=P6QR77#6#HI''"4s~~"EF77#6qr#:S__QR=P#PQ+-@A+AB/1EFr   c                  V   t               } | j                  }| j                  }t        |j                  d         }|j                  ||       t        j                  g dg dg dg      }t        j                  g dg dg dg      }t        j                  g d	g d
g dg      }t        j                  g dg dg dg      }t        t        j                  |j                        t        j                  |             t        t        j                  |j                        t        j                  |             t        t        j                  |j                        t        j                  |             t        t        j                  |j                        t        j                  |             t        j                  |j                  |z        }t        j                  |j                  |z        }	t        j                  |j                  |z        }
t        j                  |j                  |z        }t        ||	       t        |
|       t        |j                         t        |j                         t        |j                          t        |j"                         y )Nr    r!   )rF   g{cd?gr	)rH   g?g>c?)rJ   gP,"Pgͺ@)rF   gCj?g#i)rH   g2Щ?gr?)rJ   go _g<:ο)c?gD}Ȇ??g5?)UҮ?gOgөeJo?).a#οgbM4gYV?)rb   gͱ?g[K?)rc   g=mBgo1S?)rd   gP.%lgq!?)r   r%   r&   r   r'   r(   r   rN   r   rO   x_rotations_r)   y_rotations_r*   rP   r   r+   r,   )r2   r3   r4   r5   rR   expected_x_rotationsrT   expected_y_rotationsx_rotations_sign_fliprW   y_rotations_sign_fliprX   s               r   test_sanity_check_pls_canonicalrk      s    	A	A	A
AGGAJ
/CGGAqM213	
 88213	
 /22	
 88022	
 bffS%5%56?S8TUbffS^^4bff=O6PQbffS%5%56?S8TUbffS^^4bff=O6PQGGC$4$47K$KL''#..3E"EFGGC$4$47K$KL''#..3E"EF35HI35HIS^^,S^^,S]]+S]]+r   c                     d} d}d}t        d      }|j                  |       }|j                  |       }t        j                  ||||g      j                  }||j                  d| z        j                  | df      z   }||j                  d| z        j                  | df      z   }t        j                  ||j                  || z        j                  | |      fd      }t        j                  ||j                  || z        j                  | |      fd      }t        d	
      }	|	j                  ||       t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg dg      }
t        j                  g dg dg dg dg dg dg dg d g d!g d"g d#g d$g d%g d&g      }t        j                  g d'g d(g d)g d*g d+g d,g d-g d.g d/g	      }t        j                  g d0g d1g d2g d3g d4g d5g d6g d7g d8g	      }t        t        j                  |	j                        t        j                  |             t        t        j                  |	j                        t        j                  |
             t        t        j                  |	j                        t        j                  |             t        t        j                  |	j                        t        j                  |             t        j                  |	j                  |z        }t        j                  |	j                  |
z        }t        j                  |	j                  |z        }t        j                  |	j                  |z        }t        ||       t        ||       t!        |	j                         t!        |	j                         t!        |	j"                         t!        |	j$                         y )9N  
         size   r    axis   r!   )gqAS?ģƒ?g	K?)g܈m?gr[q?g֎ ÿ)gոqjP?gͱgS?)g$$?g('G_g.k^)g~gsg
?)gjh?gfrg>uRz?)g$¯&?g		lgpO/?)g}W[g~glìǿ)gWX>egj8H@Zg˔Br?)g).egw4DgoP^?)gvzgqg1GZg}r5.?)gzϳJg1?g?)gMI?g,)Ɣg [u)gei?g⊬[gQ>Oƿ)gmƫ?gE^?g0?)gB+
?g,?gi)gi*?g_(gb#k4?)g*Vh{O?g׍o}sg+Kl)gݩFgJ,c")g#'v?)g,a?g9qbgSLRW?)g]@[?gO~gkE?)ggpBgR ?g;ȿ)g-ݿp?g;O<gxgGtK?)g$U\ngE	g?)g@~_V?g,8(g.^?)g)^D_jg2i?gs6Cm?)g.f2?ggRu)g9Me?gX㰿g <ۿ)gONz '?gsVF?gul-a7?)g0?g]4?goБο)g:8%?g!Hgl?)g5z?gy0/gofy&,)g
C?g͢A}?g_%_?)g޵?gHֆ/gL:ܿ)gcIȂg$E!?gfD¹?)gϫg35ϧ?g`"ĕs?)g$t?gWe?gY)ݟ?)g#bJ$?gtdn?gx/RѸ?)g
Jn?g׷?gʏSϽ)g= ?gNfg7jN?)g]w?g(.g^i׌%)g}P
?gO3IogD'?)ghE-(g?g0֢p?gn)gzgIT4g7Ʃ1|?)gO)֠gkp2F$?gA-c?)g&?gkh?g!L?)r   normalr   rN   r   reshapeconcatenater   r(   r   rO   r-   r)   r.   r*   rP   r   r+   r,   )np_noiseq_noiserngl1l2latentsr3   r4   r5   rR   rS   rT   rU   rV   rW   rX   rY   s                     r   &test_sanity_check_pls_canonical_randomr      s7    	AGG
R
 C		B		BhhBB'(**G#**!a%*(00!Q88A#**!a%*(00!Q88A
3::7Q;:7??7KLSTUA
3::7Q;:7??7KLSTUA
A
&CGGAqM00122/10212/22	
& ((/1112111121021	
& 011101110
	
 ((.0110/210
	
 bffS__5rvv>Q7RSbffS^^4bff=O6PQbffS__5rvv>Q7RSbffS^^4bff=O6PQ773??5H#HI''#..3E"EF''#..3E"EF773??5H#HI24GH24GHS^^,S^^,S]]+S]]+r   c                      t               } | j                  }| j                  }t        |j                  d   d      }t        j                  t              5  |j                  ||       d d d        y # 1 sw Y   y xY w)Nr       r"   max_iter)	r   r%   r&   r   r'   pytestwarnsr   r(   )r2   r3   r4   
pls_nipalss       r   test_convergence_failr   Z  sV    A	A	A1771:BJ	(	)q! 
*	)	)s   A22A;Estc                     t               }|j                  }|j                  }d |       }|j                  ||       t	        fd|j
                  |j                  fD              sJ y )Nr   r!   c              3   B   K   | ]  }|j                   d    k(    yw)r    N)r'   ).0attrr"   s     r   	<genexpr>z(test_attibutes_shapes.<locals>.<genexpr>m  s#      2R$

1%2Rs   )r   r%   r&   r(   allr)   r*   )r   r2   r3   r4   r5   r"   s        @r   test_attibutes_shapesr   d  sf     	A	A	AL
<
(CGGAqM 36>>3>>2R   r   c                 8   t               }|j                  }|j                  } | d      }|j                  ||d d df         j                  }|j                  ||d d d df         j                  }|j
                  |j
                  k(  sJ t        ||       y )Nr    r!   r   )r   r%   r&   r(   coef_r'   r   )r   r2   r3   r4   estone_d_coefftwo_d_coeffs          r   test_univariate_equivalencer   r  s     	A	A	A
1
C''!Qq!tW%++K''!Qq"1"uX&,,K 1 1111k;7r   c                    t               }|j                  }|j                  }|j                         } | d      j	                  ||      }t        ||       t        j                  t              5   | d      j	                  ||       t        ||       d d d        | t        u ry |j                         }t        j                  t              5  |j                  ||d      f t        ||       d d d        |j                         }t        j                  t              5  |j                  |d      f t        ||       d d d        t        |j                  ||d      |j                  |j                         |j                         d             t        |j                  |d      |j                  |j                         d             y # 1 sw Y   AxY w# 1 sw Y   xY w# 1 sw Y   xY w)NTr/   F)r   r%   r&   r/   r(   r   r   raisesAssertionErrorr   r   r0   predict)r   r2   r3   r4   X_origr5   s         r   	test_copyr     s    	A	A	AVVXF 4.

Q
"Cq&! 
~	&Aq!!!V, 
' f}VVXF	~	&a'(!!V, 
' VVXF	~	&AE"#!!V, 
'
 a&affhu(U AD!3;;qvvxe;#D+ 
'	& 
'	&
 
'	&s$   1&G"G#$!G/G #G,/G8c               #     K   t         j                  j                  d      } d}d}d}| j                  ||      }| j                  ||      }t        j                  ||      d| j                  ||      z  z   dz   }|dz  }||f t        d      \  }}d	|d
d
df<   ||f t        j                  g dg dg dg dg      }t        j                  ddgddgddgddgg      }||f ddg}|D ]K  }t         j                  j                  |      } | j                  dd      }| j                  dd      }||f M y
w)z-Generate dataset for test_scale_and_stabilityr   i  ro   rn   r   r    T
return_X_y      ?N)r_   r_   r   )r   r_   r_   )       @r   r   )g      @g      @g      @g?gɿg?g?g@g@g'@g(@i  i  rs   rv   )r   randomRandomStaterandnr   r   rN   )	r}   	n_samples	n_targets
n_featuresr8   r4   r3   seedsseeds	            r   +_generate_test_scale_and_stability_datasetsr     sC     ))


"CIIJ		)Z(A		)Y'A
q!q399Y
;;;a?AIA
Q$J D)DAqAaeH
Q$J
/?O_UVA
3+SzC:d|DEA
Q$J #JEii##D)IIaOIIaOd
	 s   D?EzX, Yc                     t        ||      ^}}} | d      j                  ||      \  }} | d      j                  ||      \  }}	t        ||d       t        |	|d       y)zscale=True is equivalent to scale=False on centered/scaled data
    This allows to check numerical stability over platforms as wellTr#   Fg-C6?atolN)r
   rL   r   )
r   r3   r4   X_sY_srB   X_scoreY_score	X_s_score	Y_s_scores
             r   test_scale_and_stabilityr     se     $Aq)LCq44Q:GWU+99#sCIyIwT2IwT2r   	Estimatorc                 $   t         j                  j                  d      }|j                  dd      }|j                  dd      } | d      }d}t	        j
                  t        |      5  |j                  ||       ddd       y# 1 sw Y   yxY w)	zICheck the validation of `n_components` upper bounds for `PLS` regressors.r   rn   ro   rv   r!   zH`n_components` upper bound is .*. Got 10 instead. Reduce `n_components`.matchN)r   r   r   r   r   r   
ValueErrorr(   )r   r}   r3   r4   r   err_msgs         r   test_n_components_upper_boundsr     sn     ))


"C		"aA		"aA

$CXG	z	11 
2	1	1s   *BBc                  *   t         j                  j                  d      } | j                  dd      }| j                  dd      }t	        d      }d}t        j                  t        |      5  |j                  ||       d	d	d	       y	# 1 sw Y   y	xY w)
zFCheck the validation of `n_components` upper bounds for PLSRegression.r      @   rv      r!   zH`n_components` upper bound is 20. Got 30 instead. Reduce `n_components`.r   N)	r   r   r   r   r	   r   r   r   r(   )r}   r3   r4   r   r   s        r   %test_n_components_upper_PLSRegressionr     sl    
))


"C		"bA		"aA
R
(CXG	z	11 
2	1	1s   -B		Bzn_samples, n_features)d   rn   )r      c                    t        | |d|      \  }}t        ||d      \  }}}t        ||      \  }}	t        ||       t        ||	       d}
t	        |||j                         |
z         t	        ||	|	j                         |
z         y )Nro   r   random_stateT)norm_y_weightsMbP?r   )r   r   r   r   r   max)r   r   global_random_seedr3   r4   u1v1rB   u2v2rtols              r   test_singular_value_helpersr     s     :9KDAq 9AdSIBA,Q2FBRRDBD1BD1r   c                    t        ddd|       \  }}t        d      j                  ||      j                  |      }t	        d      j                  ||      j                  |      }t        d      j                  ||      j                  |      }d}t        |||j                         |z         t        |||j                         |z         y )	Nr   rn   ro   r   r    r!   r   r   )r   r   r(   r0   r	   r   r   r   )r   r3   r4   svdreg	canonicalr   s          r   test_one_component_equivalencer      s     3a>PQDAq
a
 
$
$Q
*
4
4Q
7C
Q
'
+
+Aq
1
;
;A
>C!,00A6@@CIDC3779t#34C4)?@r   c                  v   t        j                  g d      } t        j                  g d      }t        | j                  dd      |j                  dd            \  }}t	        | |       t        | |j                                t        | g d       t        ||j                                t        |g d       y )N)r    r   )r    r   rv   r   r    )r   rs   )r   r   )r   rN   r   rx   r   r   ravel)uv
u_expected
v_expecteds       r   test_svd_flip_1dr     s    
A
A%aiiA&6		!R8HIJ
AAz'')*A{#Az'')*A|$r   c                 Z   t        ddd|       \  }}t        dd      }t        j                         5  t        j                  dt
               |j                  ||       ddd       t        j                  t        j                  |j                        d	k        sJ y# 1 sw Y   AxY w)
z8Test that CCA converges. Non-regression test for #19549.r   r   )r   r   r   r   rn   rm   r   errorNr    )r   r   warningscatch_warningssimplefilterr   r(   r   r   rO   r-   )r   r3   yccas       r   test_loadings_convergesr     s    "ASDAq 2
,C		 	 	"g'9:1 
# 66"&&)A-... 
#	"s   -B!!B*c                  X   t         j                  j                  d      } | j                  dd      }t        j                  d      }t               }d}t        j                  t        |      5  |j                  ||       ddd       t        |j                  d       y# 1 sw Y    xY w)zAChecks warning when y is constant. Non-regression test for #19831*   r   rv   z#y residual is constant at iterationr   Nr   )r   r   r   randzerosr	   r   r   UserWarningr(   r   re   )r}   xr   r5   msgs        r   test_pls_constant_yr   .  sz    
))


#CaA
A
/C
/C	k	-1 
. C$$a( 
.	-s   .B  B)PLSEstimatorc                     t               }|j                  }|j                  } | d      j                  ||      }|j                  d   |j                  d   }}|j
                  j                  ||fk(  sJ y)zCheck the shape of `coef_` attribute.

    Non-regression test for:
    https://github.com/scikit-learn/scikit-learn/issues/12410
    Tr   r    N)r   r%   r&   r(   r'   r   )r   r2   r3   r4   r5   r   r   s          r   test_pls_coef_shaper   =  sh     	A	A	A
D
!
%
%a
+CGGAJ
zI99??y*5555r   r$   TFc                 |   t               }|j                  }|j                  } | d|      j                  ||      }|j	                  |d      }|j                  d      }||j                  d      z
  }t        |j                  |       t        |||j                  j                  z  |j                  z          y)z/Check the behaviour of the prediction function.T)r/   r$   r   r   rt   N)
r   r%   r&   r(   r   meanr   
intercept_r   r   )	r   r$   r2   r3   r4   r5   Y_predr<   rQ   s	            r   test_pls_predictionr   N  s     	A	A	A
D
.
2
21a
8C[[[&FVVV^F!&&a&. GCNNF+FGciikk1CNNBCr   Klassc                 `   t        d      \  }} |        j                  ||      }|j                         }| j                  j	                         }t        j                  t        |j                  j                  d         D cg c]  }| | 
 c}t              }t        ||       yc c}w )z9Check `get_feature_names_out` cross_decomposition module.Tr   r    )dtypeN)r   r(   get_feature_names_out__name__lowerr   rN   ranger)   r'   objectr   )r   r3   r4   r   	names_outclass_name_loweriexpected_names_outs           r   test_pls_feature_names_outr  `  s     D)DAq
'++a
C))+I~~++-+01E1Ea1H+IJ+IaaS	!+IJ y"45 	Ks   B+c                 v   t        j                  d      }t        dd      \  }} |        j                  d      j	                  ||      }|j                  ||      \  }}t        |t        j                        sJ t        ||j                        sJ t        |j                  |j                                y)z1Check `set_output` in cross_decomposition module.pandasT)r   as_frame)r0   N)r   importorskipr   
set_outputr(   r0   
isinstancer   ndarray	DataFramer   columnsr   )r   pdr3   r4   r   rQ   y_transs          r   test_pls_set_outputr  p  s     
		X	&BD48DAq
'

x

0
4
4Q
:C}}Q*GWgrzz***gr||,,,w(A(A(CDr   c            	         t        j                  ddgddgddgddgddgd	d
gg      } t        j                  g d      }|j                         }t               j	                  | |      }|j                  |       }|j                  |j                  k(  sJ t               j	                  | |      }t        d|fd|fg      }|j	                  | |      j                  |       }|j                  |j                  k(  sJ t        ||       y)zrCheck that when fitting with 1d `y`, prediction should also be 1d.

    Non-regression test for Issue #26549.
    r    r   rs   rv   	      ro         $   )r   r     r   r   r   lrplsrN)
r   rN   r/   r	   r(   r   r'   r   r   r   )r3   r   expectedr  y_predr  vrs          r   test_pls_regression_fit_1d_yr  }  s    
 	1a&1a&1a&1b'Ar7QGDEA
'(AvvxH?q!$D\\!_F<<8>>))) 
			1	%B	4*vtn5	6BVVAq\!!!$F<<8>>)))FH%r   c                  F   t         j                  j                  d      } | j                  d      }| j	                  dd      }||j
                  z  }t        dd	      j                  ||      }t        |j                  |       t        |j                  |      |       y
)zCheck that when using `scale=True`, the coefficients are using the std. dev. from
    both `X` and `Y`.

    Non-regression test for:
    https://github.com/scikit-learn/scikit-learn/issues/27964
    r   )rv   ro   rq   rn   )r   ro   )r$   rr   ro   T)r"   r$   N)r   r   r   uniformrw   r   r	   r(   r   r   r   )r}   coefr3   r4   r5   s        r    test_pls_regression_scaling_coefr#    s     ))


"C;;F;#D

'
*A	DFF
A Qd
3
7
71
=CCIIt$ CKKNA&r   c                 x   t               }|j                  }|j                  }|j                  }d}t        j                  t
        |      5   |        j                  ||       d d d        d}t        j                  t
        |      5  t        j                  t        |      5   |        j                  |||       d d d        d d d        d}t        j                  t        |      5   |        j                  |       d d d        y # 1 sw Y   xY w# 1 sw Y   ZxY w# 1 sw Y   ^xY w# 1 sw Y   y xY w)NE`Y` is deprecated in 1.5 and will be removed in 1.7. Use `y` instead.r   r3   r4   ?Cannot use both `y` and `Y`. Use only `y` as `Y` is deprecated.zy is required.)	r   r%   r&   r   r   FutureWarningr(   r   r   )r   r2   r3   r4   r   r   err_msg1err_msg2s           r   -test_pls_fit_warning_on_deprecated_Y_argumentr+    s     	A	A	A	A
QC	m3	/a1 
0 QH]#.j1Aq! 	2 	/
  H	z	2A 
3	2 
0	/ 	21 	/. 
3	2s<   D
D$&D?D$,D0DD!	D$$D-0D9c                    t               }|j                  }|j                  }|j                  } |        j                  ||      }d}t	        j
                  t        |      5  |j                  ||       d d d        d}t	        j
                  t        |      5  t	        j                  t        |      5  |j                  |||       d d d        d d d        y # 1 sw Y   gxY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr%  r   r&  r'  )
r   r%   r&   r(   r   r   r(  r0   r   r   )r   r2   r3   r4   r   r  r   r)  s           r   3test_pls_transform_warning_on_deprecated_Y_argumentr-    s     	A	A	A	A7;;q!D
QC	m3	/a  
0 QH]#.j1q!Q 	2 	/. 
0	/ 	21 	/.s0   #CC58C)C5C&)C2	.C55C>c                    t               }|j                  }|j                  } |        j                  ||      }|j	                  ||      \  }}d}t        j                  t        |      5  |j                  ||       d d d        d}t        j                  t        |      5  t        j                  t        |      5  |j                  |||       d d d        d d d        y # 1 sw Y   hxY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr%  r   r&  r'  )r3   r   r4   )r   r%   r&   r(   r0   r   r   r(  r1   r   r   )	r   r2   r3   r   r  X_transformedy_transformedr   r)  s	            r   ;test_pls_inverse_transform_warning_on_deprecated_Y_argumentr1    s     	A	A	A7;;q!D#'>>!Q#7 M=
QC	m3	/-@ 
0 QH]#.j1-=Q 	2 	/. 
0	/ 	21 	/.s0   ,C'%C?C3C?'C03C<	8C??D)=r   numpyr   r   numpy.testingr   r   r   sklearn.cross_decompositionr   r   r   r	    sklearn.cross_decomposition._plsr
   r   r   r   sklearn.datasetsr   r   sklearn.ensembler   sklearn.exceptionsr   sklearn.linear_modelr   sklearn.utilsr   sklearn.utils.extmathr   r   rD   rZ   r`   rk   r   r   markparametrizer   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r#  r+  r-  r1   r   r   <module>r?     s%      X X P P  < , 1 1 , *6
%)P<I~/Gd;,|e,P  EF
 G
 c BC8 D8 c6 JK# L#L@ lM6 JK!L!NO
3 P L
3 v}lC&PQ R 09j2IJ2 K2"A%/") -s)KL6 M6  4-0-s)KLD M 1D  3|"LM6 N6 3|"LM	E N	E&*'. =#v|"LM N2 =#v|"LM  N , =#|"DER FRr   