
    Pi%                     l   d dl Z d dlZd dlZd dlmZmZ d dlmZm	Z	m
Z
 d dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- d dl.m/Z/ d dl0m1Z1m2Z2 d dl3m4Z4m5Z5 d dl6m7Z7m8Z8 d d	l9m:Z: ej;        <                    d
 e             e             e             e             e             e             e             e             e             e             e             ej=         eddd          ej;        >                    d                     eddd           e             e             e             e             e              e!             e%             e&             e)             ej=         e+d          ej;        >                    d                     e+dd           e-d           gd           ej;        <                    dddg          d                          Z?ej;        @                    d!          ej;        @                    d"          ej;        @                    d#          ej;        <                    d$eeeeeeeeeeeeee5ee e!e#e%e&e)e+e,e-g          ej;        <                    d%d&d'g          d(                                                             ZAej;        <                    d)d*ge4i fei fed+ddd,fe"i fe$i fe'i fe(i fe*i fg          ej;        <                    d-d'd.g          d/                         ZBej;        <                    d0edd1d2fed3difed3dife'd4d5d6fedd&d1d7fedd8d1d7fe&d4d9d5d:fei fe)i fe(i fg
          ej;        <                    d;e:          d<                         ZCdS )=    N)cloneis_classifier)make_classificationmake_low_rank_matrixmake_regression)"ARDRegressionBayesianRidge
ElasticNetElasticNetCVGammaRegressorHuberRegressorLarsLarsCVLassoLassoCV	LassoLarsLassoLarsCVLassoLarsICLinearRegressionLogisticRegressionLogisticRegressionCVMultiTaskElasticNetMultiTaskElasticNetCVMultiTaskLassoMultiTaskLassoCVOrthogonalMatchingPursuitOrthogonalMatchingPursuitCVPassiveAggressiveClassifierPassiveAggressiveRegressor
PerceptronPoissonRegressorRidgeRidgeClassifierRidgeClassifierCVRidgeCVSGDClassifierSGDRegressorTheilSenRegressorTweedieRegressor)make_pipeline)MinMaxScalerStandardScaler)	LinearSVC	LinearSVR)assert_allcloseset_random_state)CSR_CONTAINERSmodel      ?sagaV瞯<)l1_ratiosolvertolz"Missing importance sampling scheme)reason)marksgư>F)r   )r8   use_legacy_attributes	l1_ratios)r8   zInsufficient precision.
elasticneti'  )penaltymax_iter)powerc                     | j         j        S )N)	__class____name__)xs    z/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/sklearn/linear_model/tests/test_common.py<lambda>rF   \   s    !+&     )idswith_sample_weightTc                    t          |           } |rFdt          j        | j                  j                                        vrt          j        d           d}t          | t                    rd}nt          | d          r| j        dk    rd}t          j                            |          }d\  }}}t          | t          t           t"          t$          f          rd	}t'          |||
          }|r<|                    dd||f          t          j        |d          d d d f         z  }	n/|                    dd|          t          j        |d          z  }	t          j        ||	z  dz             }
|                    |
          dz   }t1          |           r&||
dz   k                        t          j                  }|r$|                    dd|j        d                   }nd }|                     d           |r|                     |||           n|                     ||           t1          |           rct          j        |                     |          d d df         |          t          j        t          j        ||          |          k    sJ d S t          j        |                      |          |d          t          j        t          j        ||d          |          k    sJ d S )Nsample_weightz)Estimator does not support sample_weight.g-C6*?皙?r7   r4   {Gz?)d   
   N   )	n_samples
n_featuresrandom_state   )lowhighsizer   )axisr3   )lam   rO   T)fit_intercept)rK   )weights)rel)r]   rY   )!r   inspect	signaturefit
parameterskeyspytestskip
isinstancer'   hasattrr7   nprandomRandomStater   r   r   r   r   uniformmaxexppoissonr   astypefloat64shape
set_paramsaveragepredict_probaapproxpredict)r2   rI   global_random_seedr^   rngn_trainrR   	n_targetsXcoefexpectationysws                rE   test_balance_propertyr   6   s3   j %LLEA7#4UY#?#?#J#O#O#Q#QQQ?@@@
C%&& 		!	! elf&<&<
)

 2
3
3C%2"GZ	3^EUV   	w:TWXXXA PKKBQj)-DKEEfQQ4() 	
 {{r
{;;bfQQ>O>O>OO&TC((K$$q(AU 5q ((44 [[QRagaj[99	4((( 		!Qb	))))		!QU 
z%--a00A6CCCv}Jq"%%%3H
 H
 H
 
 
 
 
 
 
 z%--**BQ???6=Jq"1---3D
 D
 D
 
 
 
 
 
 
rG   z!ignore:The default of 'normalize'zignore:lbfgs failed to convergez5ignore:A column-vector y was passed when a 1d array.*	Regressorndimr[   rU   c                    | t           u rt          j        d           t          ddd          \  }}t	                                          |                    dd                    dddf         dz   }|d	k    r|ddt          j        f         n|} |             }t          |           |
                    ||           |j        j        |j        d         fk    sJ dS )
z4Check the consistency of linear models `coef` shape.z8LinearRegression does not follow `coef_` shape contract!r         )rS   rQ   rR   r[   NrU   )r   rd   xfailr   r+   fit_transformreshaperh   newaxisr0   ra   coef_rq   )r   r   r{   r~   	regressors        rE   &test_linear_model_regressor_coef_shaper      s    F $$$OPPPSRHHHDAq$$QYYr1%5%566qqq!t<q@A AII!!!RZ-1A	IYMM!Q? QWQZM111111rG   
Classifierparamsznewton-cholesky)r7   r;   r<   	n_classesrP   c                 2   | t           t          fv rt          j        |  d           t	          d|d          \  }}|j        d         } | di |}t          |           |                    ||           |dk    rd|fn||f}|j        j        |k    sJ d S )Nz( does not follow `coef_` shape contract!rO   r   )n_informativer   rS   r[   rU    )	r#   r$   rd   r   r   rq   r0   ra   r   )r   r   r   r{   r~   rR   
classifierexpected_shapes           rE   'test_linear_model_classifier_coef_shaper      s    , o'8999
LLLMMMR9STUUUDAqJ%%f%%JZ   NN1a(1Qa__Y
<SN!^333333rG   zLinearModel, paramsrM   )r8   alphar8   	sparse_cgrL   )r7   r   )r8   r6   r   gh㈵>g-q=)r7   r8   r   csr_containerc                    t          t          d           | di |          }t          t          d           | di |          }t          j                            d          }d}d}|                    ||          }d||dk     <    ||          }	|                    |          }
t          |          rt          j        |
          }
|	                    ||
           |	                    |	|
           t          |d         j        |d         j        d	
           |                    |          }|                    |	          }t          ||           t          |d         j        |d         j                   dS )zTest that sparse and dense linear models give same results.

    Models use a preprocessing pipeline with a StandardScaler.
    F)	with_meanr   rN   rU   g        rL   r[   r5   )atolNr   )r*   r,   rh   ri   rj   randnrandr   signra   r/   r   rv   
intercept_)LinearModelr   r   model_densemodel_sparserx   rQ   rR   r{   X_sparser~   y_pred_densey_pred_sparses                rE   )test_model_pipeline_same_dense_and_sparser      s~   *   ? ? ?AVAVvAVAVWWK %!@!@!@++BWBWPVBWBWXXL )


"
"CIJ		)Z((AAa#gJ}QHA[!! GAJJOOAqXq!!!LO);q>+?eLLLL&&q))L ((22ML-000KN-|A/IJJJJJrG   )Dr_   numpyrh   rd   sklearn.baser   r   sklearn.datasetsr   r   r   sklearn.linear_modelr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   sklearn.pipeliner*   sklearn.preprocessingr+   r,   sklearn.svmr-   r.   sklearn.utils._testingr/   r0   sklearn.utils.fixesr1   markparametrizeparamr   r   filterwarningsr   r   r   r   rG   rE   <module>r      s         - - - - - - - - W W W W W W W W W W# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #H + * * * * * > > > > > > > > , , , , , , , , D D D D D D D D . . . . . . 
		 	FFFF+##+O#PP	
 	
 	
 	UdSSS!!####%%		LU###+##+D#EE	
 	
 	
 	\F;;;q!!!E#H 	'&M  ' 'P -t}==@
 @
 >=Q' 'R@
F ?@@=>>STT!#"1 : !Q((2 2 )(;  UT ?> A@B2 8	B	R  +).! 	
 
%b)	R	"	B	 ( q!f--4 4 .-) *4 	--.	5%.!	u~&	[3??@	UDAAB	UtDDE	;usCCD	2	"	B  .99K K :9  K K KrG   