
    -i~                       S SK r S SKrS SKrS SKJrJ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JrJr  SS
KJr  SSKJrJrJr  SSKJrJrJrJ r   SSK!J"r"J#r#J$r$J%r%  SSK&J'r'  SSK(J)r)J*r*  SSK+J,r,J-r-  SSK.J/r/J0r0J1r1J2r2J3r3J4r4J5r5  SSK6J7r8  SSK9J:r:J;r;J<r<  SAS jr=       SBS jr>\%" SS/SS/\#" \	S SSS9/\#" \SSSS9/SS/\$" S 15      S!S/SS/S!/SS/S"/S!/S!/S#.SS$9SSSS SSSS%S%S%S&.
S' j5       r?\%" SS/SS/\#" \	S(SS)S9/\#" \	S(SSS9/\#" \SSSS9/SS/\$" S 15      S!S/SS/S!/SS/S"/S!/S!/S!/S*.SS$9S+SSSS SSSS%S%S%SS,.S- j5       r@ " S. S/\\\:5      rA " S0 S1\A5      rB    SCS2 jrC " S3 S4\\:\5      rD " S5 S6\\D5      rE " S7 S8\\D5      rF " S9 S:\B5      rG " S; S<\G5      rH " S= S>\\D5      rI " S? S@\\D5      rJg)D    N)ABCabstractmethod)partial)IntegralReal)effective_n_jobs)sparse)metadata_routing   )MultiOutputMixinRegressorMixin_fit_context)check_cv)Bunchcheck_arraycheck_scalar)MetadataRouterMethodMapping_raise_for_paramsget_routing_for_object)HiddenInterval
StrOptionsvalidate_params)safe_sparse_dot)_routing_enabledprocess_routing)Paralleldelayed)_check_sample_weightcheck_consistent_lengthcheck_is_fittedcheck_random_statecolumn_or_1dhas_fit_parametervalidate_data   )_cd_fast)LinearModel_pre_fit_preprocess_datac                 p   US;  a  [        SR                  U5      5      e[        R                  " U 5      n[        R                  " U5      nUbe  US:X  a  SOSnU(       a  U R	                  USS9n O[
        R                  " XS9n U(       a  UR	                  U5      nX4$ [
        R                  " XS9nX4$ )	aT  Change the order of X and y if necessary.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data.

y : ndarray of shape (n_samples,)
    Target values.

order : {None, 'C', 'F'}
    If 'C', dense arrays are returned as C-ordered, sparse matrices in csr
    format. If 'F', dense arrays are return as F-ordered, sparse matrices
    in csc format.

Returns
-------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data with guaranteed order.

y : ndarray of shape (n_samples,)
    Target values with guaranteed order.
)NCFz<Unknown value for order. Got {} instead of None, 'C' or 'F'.r.   csccsrF)copyorder)
ValueErrorformatr	   issparseasformatnpasarray)Xyr3   sparse_Xsparse_ysparse_formats         [/var/www/html/venv/lib/python3.13/site-packages/sklearn/linear_model/_coordinate_descent.py
_set_orderr@   0   s    0 $$JQQRWX
 	
 q!Hq!H!&#5

=u
5A

1*A

=)A 4K 

1*A4K          ?TMbP?d   c	           	         US:X  a  [        S5      eUb  Un	O[        U UUUUSS9u  pn
  nUb*  UR                  S:  a  XR                  SS5      -  nOX-  nOUn[        R
                  " U 5      (       a0  [        U R                  USS	9[        R                  " U5      U
-  -
  n	O![        R                  " U R                  U5      n	U	R                  S:X  a  U	SS2[        R                  4   n	Ub  UR                  5       nOU R                  S   n[        R                  " [        R                  " U	S
-  SS95      R                  5       X-  -  nU[        R                  " [        R                   5      R"                  ::  aC  [        R$                  " U[        R                  " [        R                   5      R"                  5      $ [        R&                  " XU-  US9$ )a  Compute the grid of alpha values for elastic net parameter search

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data. Pass directly as Fortran-contiguous data to avoid
    unnecessary memory duplication

y : ndarray of shape (n_samples,) or (n_samples, n_outputs)
    Target values

Xy : array-like of shape (n_features,) or (n_features, n_outputs),         default=None
    Xy = np.dot(X.T, y) that can be precomputed.

l1_ratio : float, default=1.0
    The elastic net mixing parameter, with ``0 < l1_ratio <= 1``.
    For ``l1_ratio = 0`` the penalty is an L2 penalty. (currently not
    supported) ``For l1_ratio = 1`` it is an L1 penalty. For
    ``0 < l1_ratio <1``, the penalty is a combination of L1 and L2.

eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``

n_alphas : int, default=100
    Number of alphas along the regularization path

fit_intercept : bool, default=True
    Whether to fit an intercept or not

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

sample_weight : ndarray of shape (n_samples,), default=None
r   zAutomatic alpha grid generation is not supported for l1_ratio=0. Please supply a grid by providing your estimator with the appropriate `alphas=` argument.NF)fit_interceptr1   sample_weightcheck_inputr'   Tdense_outputr   axis)num)r4   r+   ndimreshaper	   r6   r   Tr8   sumdotnewaxisshapesqrtmaxfinfofloat64
resolutionfull	geomspace)r:   r;   Xyl1_ratiorF   epsn_alphascopy_XrG   XywX_offset_yw	n_samples	alpha_maxs                  r?   _alpha_gridrh   _   s   ^ 1}
 	
 
~/'' 
h1 $vvz..r155&B??1!!##r=r
X@UUC&&b/C
xx1}!RZZ-  !%%'	GGAJ	sAvA./3359MNIBHHRZZ(333wwx"**!5!@!@AA<<	s?AArA   
array-likezsparse matrixneitherclosedleftautobooleanverbose)r:   r;   r_   r`   alphas
precomputer]   ra   	coef_initrp   return_n_iterpositiveprefer_skip_nested_validationF)
r_   r`   rq   rr   r]   ra   rs   rp   rt   ru   c       
         4    [        U U4SUUUUUUUU	UU
S.UD6$ )a  Compute Lasso path with coordinate descent.

The Lasso optimization function varies for mono and multi-outputs.

For mono-output tasks it is::

    (1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1

For multi-output tasks it is::

    (1 / (2 * n_samples)) * ||Y - XW||^2_Fro + alpha * ||W||_21

Where::

    ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2}

i.e. the sum of norm of each row.

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

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data. Pass directly as Fortran-contiguous data to avoid
    unnecessary memory duplication. If ``y`` is mono-output then ``X``
    can be sparse.

y : {array-like, sparse matrix} of shape (n_samples,) or         (n_samples, n_targets)
    Target values.

eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``.

n_alphas : int, default=100
    Number of alphas along the regularization path.

alphas : array-like, default=None
    List of alphas where to compute the models.
    If ``None`` alphas are set automatically.

precompute : 'auto', bool or array-like of shape             (n_features, n_features), default='auto'
    Whether to use a precomputed Gram matrix to speed up
    calculations. If set to ``'auto'`` let us decide. The Gram
    matrix can also be passed as argument.

Xy : array-like of shape (n_features,) or (n_features, n_targets),         default=None
    Xy = np.dot(X.T, y) that can be precomputed. It is useful
    only when the Gram matrix is precomputed.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

coef_init : array-like of shape (n_features, ), default=None
    The initial values of the coefficients.

verbose : bool or int, default=False
    Amount of verbosity.

return_n_iter : bool, default=False
    Whether to return the number of iterations or not.

positive : bool, default=False
    If set to True, forces coefficients to be positive.
    (Only allowed when ``y.ndim == 1``).

**params : kwargs
    Keyword arguments passed to the coordinate descent solver.

Returns
-------
alphas : ndarray of shape (n_alphas,)
    The alphas along the path where models are computed.

coefs : ndarray of shape (n_features, n_alphas) or             (n_targets, n_features, n_alphas)
    Coefficients along the path.

dual_gaps : ndarray of shape (n_alphas,)
    The dual gaps at the end of the optimization for each alpha.

n_iters : list of int
    The number of iterations taken by the coordinate descent optimizer to
    reach the specified tolerance for each alpha.

See Also
--------
lars_path : Compute Least Angle Regression or Lasso path using LARS
    algorithm.
Lasso : The Lasso is a linear model that estimates sparse coefficients.
LassoLars : Lasso model fit with Least Angle Regression a.k.a. Lars.
LassoCV : Lasso linear model with iterative fitting along a regularization
    path.
LassoLarsCV : Cross-validated Lasso using the LARS algorithm.
sklearn.decomposition.sparse_encode : Estimator that can be used to
    transform signals into sparse linear combination of atoms from a fixed.

Notes
-----
For an example, see
:ref:`examples/linear_model/plot_lasso_lasso_lars_elasticnet_path.py
<sphx_glr_auto_examples_linear_model_plot_lasso_lasso_lars_elasticnet_path.py>`.

To avoid unnecessary memory duplication the X argument of the fit method
should be directly passed as a Fortran-contiguous numpy array.

Note that in certain cases, the Lars solver may be significantly
faster to implement this functionality. In particular, linear
interpolation can be used to retrieve model coefficients between the
values output by lars_path

Examples
--------

Comparing lasso_path and lars_path with interpolation:

>>> import numpy as np
>>> from sklearn.linear_model import lasso_path
>>> X = np.array([[1, 2, 3.1], [2.3, 5.4, 4.3]]).T
>>> y = np.array([1, 2, 3.1])
>>> # Use lasso_path to compute a coefficient path
>>> _, coef_path, _ = lasso_path(X, y, alphas=[5., 1., .5])
>>> print(coef_path)
[[0.         0.         0.46874778]
 [0.2159048  0.4425765  0.23689075]]

>>> # Now use lars_path and 1D linear interpolation to compute the
>>> # same path
>>> from sklearn.linear_model import lars_path
>>> alphas, active, coef_path_lars = lars_path(X, y, method='lasso')
>>> from scipy import interpolate
>>> coef_path_continuous = interpolate.interp1d(alphas[::-1],
...                                             coef_path_lars[:, ::-1])
>>> print(coef_path_continuous([5., 1., .5]))
[[0.         0.         0.46915237]
 [0.2159048  0.4425765  0.23668876]]
rB   )r^   r_   r`   rq   rr   r]   ra   rs   rp   ru   rt   )	enet_path)r:   r;   r_   r`   rq   rr   r]   ra   rs   rp   rt   ru   paramss                r?   
lasso_pathr{      sJ    Z 		 #  rA           both)r:   r;   r^   r_   r`   rq   rr   r]   ra   rs   rp   rt   ru   rH         ?)r^   r_   r`   rq   rr   r]   ra   rs   rp   rt   ru   rH   c                	   UR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  S	S5      nUR                  S
S5      n[        U5      S:  a  [        SUR                  5       5      eU(       ap  [	        U S[
        R                  [
        R                  /SUS9n [	        USU R                  R                  SSSS9nUb   [	        XpR                  R                  SSSS9nU R                  u  nnSnUR                  S:w  a  SnUR                  S   nU(       a  U(       a  [        S5      eU(       db  [        R                  " U 5      (       aG  Ub%  UU-  n[
        R                  " UU R                  S9nO[
        R                  " UU R                  S9nU(       a  [!        U UUUSSUS9u  p    npgUc  [#        U UUUSUUSS9nO+[        U5      S:  a  [
        R$                  " U5      SSS2   n[        U5      n[
        R&                  " U5      n/ n[)        U5      nUS;  a  [        S5      eUS:H  nU(       d"  [
        R&                  " UU4U R                  S9n O"[
        R&                  " WUU4U R                  S9n U	c.  [
        R                  " U R                  SS U R                  SS9n!O[
        R*                  " XR                  S9n![-        U5       GH  u  n"n#U#U-  U-  n$U#S U-
  -  U-  n%U(       d[  [        R                  " U 5      (       a@  [.        R0                  " U!U$U%U R2                  U R4                  U R6                  UUWUUUUUS!9n&OU(       a  [.        R8                  " U!U$U%XUUUU5	      n&O[;        U[
        R<                  5      (       aF  U(       a  [	        X`R                  R                  SS9n[.        R>                  " U!U$U%UUUUUUUU5      n&O2USL a  [.        R@                  " U!U$U%XUUUUU5
      n&O[        S"U-  5      eU&u  n!n'n(n)U!U S#U"4'   U'U-  UU"'   URC                  U)5        U
(       d  GMi  U
S$:  a  [E        U&5        GM}  U
S:  a  [E        S%U"U4-  5        GM  [F        RH                  RK                  S&5        GM     U(       a  UU UU4$ UU U4$ )'a  Compute elastic net path with coordinate descent.

The elastic net optimization function varies for mono and multi-outputs.

For mono-output tasks it is::

    1 / (2 * n_samples) * ||y - Xw||^2_2
    + alpha * l1_ratio * ||w||_1
    + 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2

For multi-output tasks it is::

    (1 / (2 * n_samples)) * ||Y - XW||_Fro^2
    + alpha * l1_ratio * ||W||_21
    + 0.5 * alpha * (1 - l1_ratio) * ||W||_Fro^2

Where::

    ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2}

i.e. the sum of norm of each row.

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

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data. Pass directly as Fortran-contiguous data to avoid
    unnecessary memory duplication. If ``y`` is mono-output then ``X``
    can be sparse.

y : {array-like, sparse matrix} of shape (n_samples,) or         (n_samples, n_targets)
    Target values.

l1_ratio : float, default=0.5
    Number between 0 and 1 passed to elastic net (scaling between
    l1 and l2 penalties). ``l1_ratio=1`` corresponds to the Lasso.

eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``.

n_alphas : int, default=100
    Number of alphas along the regularization path.

alphas : array-like, default=None
    List of alphas where to compute the models.
    If None alphas are set automatically.

precompute : 'auto', bool or array-like of shape             (n_features, n_features), default='auto'
    Whether to use a precomputed Gram matrix to speed up
    calculations. If set to ``'auto'`` let us decide. The Gram
    matrix can also be passed as argument.

Xy : array-like of shape (n_features,) or (n_features, n_targets),         default=None
    Xy = np.dot(X.T, y) that can be precomputed. It is useful
    only when the Gram matrix is precomputed.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

coef_init : array-like of shape (n_features, ), default=None
    The initial values of the coefficients.

verbose : bool or int, default=False
    Amount of verbosity.

return_n_iter : bool, default=False
    Whether to return the number of iterations or not.

positive : bool, default=False
    If set to True, forces coefficients to be positive.
    (Only allowed when ``y.ndim == 1``).

check_input : bool, default=True
    If set to False, the input validation checks are skipped (including the
    Gram matrix when provided). It is assumed that they are handled
    by the caller.

**params : kwargs
    Keyword arguments passed to the coordinate descent solver.

Returns
-------
alphas : ndarray of shape (n_alphas,)
    The alphas along the path where models are computed.

coefs : ndarray of shape (n_features, n_alphas) or             (n_targets, n_features, n_alphas)
    Coefficients along the path.

dual_gaps : ndarray of shape (n_alphas,)
    The dual gaps at the end of the optimization for each alpha.

n_iters : list of int
    The number of iterations taken by the coordinate descent optimizer to
    reach the specified tolerance for each alpha.
    (Is returned when ``return_n_iter`` is set to True).

See Also
--------
MultiTaskElasticNet : Multi-task ElasticNet model trained with L1/L2 mixed-norm     as regularizer.
MultiTaskElasticNetCV : Multi-task L1/L2 ElasticNet with built-in cross-validation.
ElasticNet : Linear regression with combined L1 and L2 priors as regularizer.
ElasticNetCV : Elastic Net model with iterative fitting along a regularization path.

Notes
-----
For an example, see
:ref:`examples/linear_model/plot_lasso_lasso_lars_elasticnet_path.py
<sphx_glr_auto_examples_linear_model_plot_lasso_lasso_lars_elasticnet_path.py>`.

Examples
--------
>>> from sklearn.linear_model import enet_path
>>> from sklearn.datasets import make_regression
>>> X, y, true_coef = make_regression(
...    n_samples=100, n_features=5, n_informative=2, coef=True, random_state=0
... )
>>> true_coef
array([ 0.        ,  0.        ,  0.        , 97.9, 45.7])
>>> alphas, estimated_coef, _ = enet_path(X, y, n_alphas=3)
>>> alphas.shape
(3,)
>>> estimated_coef
 array([[ 0.,  0.787,  0.568],
        [ 0.,  1.120,  0.620],
        [-0., -2.129, -1.128],
        [ 0., 23.046, 88.939],
        [ 0., 10.637, 41.566]])
rc   NX_scalerG   tol-C6?max_iter  random_state	selectioncyclicr   zUnexpected parameters in paramsr/   r.   )accept_sparsedtyper3   r1   F)r   r   r3   r1   	ensure_2dr-   )r   r3   r1   r   r'   Tz;positive=True is not allowed for multi-output (y.ndim != 1)r   )rF   r1   rH   )r]   r^   rF   r_   r`   ra   rI   )randomr   z,selection should be either random or cyclic.r   r   r3   rB   )walphabetaX_data	X_indicesX_indptrr;   rG   X_meanr   r   rngr   ru   zEPrecompute should be one of True, False, 'auto' or array-like. Got %r.r   zPath: %03i out of %03i.)&poplenr4   keysr   r8   rY   float32r   typerU   rO   r	   r6   r9   zerosr*   rh   sortemptyr#   asfortranarray	enumeratecd_fastsparse_enet_coordinate_descentdataindicesindptr"enet_coordinate_descent_multi_task
isinstancendarrayenet_coordinate_descent_gramenet_coordinate_descentappendprintsysstderrwrite)*r:   r;   r^   r_   r`   rq   rr   r]   ra   rs   rp   rt   ru   rH   rz   X_offset_paramX_scale_paramrG   r   r   r   r   rf   
n_featuresmulti_output	n_targetsX_sparse_scalingrd   	dual_gapsn_itersr   r   coefscoef_ir   l1_regl2_regmodel	dual_gap_eps_n_iter_s*                                             r?   ry   ry   y  s   X ZZ
D1NJJy$/MJJ5M
**UD
!Czz*d+H::nd3L

;1I
6{Q:FKKMJJ ::rzz*
 '',,
 >'',,cB GGIzLvv{GGAJ	VWW FOOA..%  .=!zz*:!''J!xx
!''B (0#)
%aAz ~ 	
 
Vq2&6{H"IG
\
*C,,GHH("F*h/qww?)Z:!''JSb)D!!)77;f%5!I-#.)I5 2 2::vv))+'!!E  >>vvqXsCE 
BJJ// (77<<sS
88E 5 33vvqXsCE W  +0'y$c1f !9,	!w7{e1.!X>?

  %C &F ui005)##rA   c                   @  ^  \ rS rSr% SrS\R                  0r\" \	SSSS9/\" \	SSS	S9/S
/S
S/\" \
SSSS9S/S
/\" \	SSSS9/S
/S
/S/\" SS15      /S.r\\S'   \" \5      r SSSSSSSSSSSS.
S jjr\" SS9SS j5       r\S 5       rU 4S jrU 4S jrSrU =r$ ) 
ElasticNeti  a  Linear regression with combined L1 and L2 priors as regularizer.

Minimizes the objective function::

        1 / (2 * n_samples) * ||y - Xw||^2_2
        + alpha * l1_ratio * ||w||_1
        + 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2

If you are interested in controlling the L1 and L2 penalty
separately, keep in mind that this is equivalent to::

        a * ||w||_1 + 0.5 * b * ||w||_2^2

where::

        alpha = a + b and l1_ratio = a / (a + b)

The parameter l1_ratio corresponds to alpha in the glmnet R package while
alpha corresponds to the lambda parameter in glmnet. Specifically, l1_ratio
= 1 is the lasso penalty. Currently, l1_ratio <= 0.01 is not reliable,
unless you supply your own sequence of alpha.

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

Parameters
----------
alpha : float, default=1.0
    Constant that multiplies the penalty terms. Defaults to 1.0.
    See the notes for the exact mathematical meaning of this
    parameter. ``alpha = 0`` is equivalent to an ordinary least square,
    solved by the :class:`LinearRegression` object. For numerical
    reasons, using ``alpha = 0`` with the ``Lasso`` object is not advised.
    Given this, you should use the :class:`LinearRegression` object.

l1_ratio : float, default=0.5
    The ElasticNet mixing parameter, with ``0 <= l1_ratio <= 1``. For
    ``l1_ratio = 0`` the penalty is an L2 penalty. ``For l1_ratio = 1`` it
    is an L1 penalty.  For ``0 < l1_ratio < 1``, the penalty is a
    combination of L1 and L2.

fit_intercept : bool, default=True
    Whether the intercept should be estimated or not. If ``False``, the
    data is assumed to be already centered.

precompute : bool or array-like of shape (n_features, n_features),                 default=False
    Whether to use a precomputed Gram matrix to speed up
    calculations. The Gram matrix can also be passed as argument.
    For sparse input this option is always ``False`` to preserve sparsity.
    Check :ref:`an example on how to use a precomputed Gram Matrix in ElasticNet
    <sphx_glr_auto_examples_linear_model_plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py>`
    for details.

max_iter : int, default=1000
    The maximum number of iterations.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``, see Notes below.

warm_start : bool, default=False
    When set to ``True``, reuse the solution of the previous call to fit as
    initialization, otherwise, just erase the previous solution.
    See :term:`the Glossary <warm_start>`.

positive : bool, default=False
    When set to ``True``, forces the coefficients to be positive.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
    Parameter vector (w in the cost function formula).

sparse_coef_ : sparse matrix of shape (n_features,) or             (n_targets, n_features)
    Sparse representation of the `coef_`.

intercept_ : float or ndarray of shape (n_targets,)
    Independent term in decision function.

n_iter_ : list of int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance.

dual_gap_ : float or ndarray of shape (n_targets,)
    Given param alpha, the dual gaps at the end of the optimization,
    same shape as each observation of y.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
ElasticNetCV : Elastic net model with best model selection by
    cross-validation.
SGDRegressor : Implements elastic net regression with incremental training.
SGDClassifier : Implements logistic regression with elastic net penalty
    (``SGDClassifier(loss="log_loss", penalty="elasticnet")``).

Notes
-----
To avoid unnecessary memory duplication the X argument of the fit method
should be directly passed as a Fortran-contiguous numpy array.

The precise stopping criteria based on `tol` are the following: First, check that
that maximum coordinate update, i.e. :math:`\max_j |w_j^{new} - w_j^{old}|`
is smaller than `tol` times the maximum absolute coefficient, :math:`\max_j |w_j|`.
If so, then additionally check whether the dual gap is smaller than `tol` times
:math:`||y||_2^2 / n_{      ext{samples}}`.

Examples
--------
>>> from sklearn.linear_model import ElasticNet
>>> from sklearn.datasets import make_regression

>>> X, y = make_regression(n_features=2, random_state=0)
>>> regr = ElasticNet(random_state=0)
>>> regr.fit(X, y)
ElasticNet(random_state=0)
>>> print(regr.coef_)
[18.83816048 64.55968825]
>>> print(regr.intercept_)
1.451
>>> print(regr.predict([[0, 0]]))
[1.451]

-   :ref:`sphx_glr_auto_examples_linear_model_plot_lasso_and_elasticnet.py`
    showcases ElasticNet alongside Lasso and ARD Regression for sparse
    signal recovery in the presence of noise and feature correlation.
rH   r   Nrm   rk   r'   r}   ro   ri   r   r   r   r   r^   rF   rr   r   ra   r   
warm_startru   r   r   _parameter_constraintsr~   TFr   r   )
r^   rF   rr   r   ra   r   r   ru   r   r   c       
             Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        g Nr   )selfr   r^   rF   rr   r   ra   r   r   ru   r   r   s               r?   __init__ElasticNet.__init__  s=     
 *$ $ ("rA   rv   c                 l   U R                   S:X  a  [        R                  " SSS9  SnU(       as  U R                  =(       a    U R                  n[        U UUSS[        R                  [        R                  /SSUSSS	9u  p[        USSUR                  R                  SS
9nUR                  u  pgU R                   n[        U[        R                  5      (       a  SnUb6  U(       a  [!        X1UR                  S9nX6[        R"                  " U5      -  -  nU R                  =(       a    U(       + n	[%        UUSU R&                  U R                  U	UUS9u  pppnU(       d  Ub  [)        XSS9u  pUR*                  S:X  a  USS2[        R,                  4   nUb'  UR*                  S:X  a  USS2[        R,                  4   nUR                  S   nU R.                  (       a  [1        U S5      (       d"  [        R2                  " X4UR                  SS9nO3U R4                  nUR*                  S:X  a  U[        R,                  SS24   n[        R2                  " XR                  S9n/ U l        [9        U5       H  nUb
  USS2U4   nOSnU R;                  UUSS2U4   U R<                  SSU/UUSUU   SSU R>                  SU R@                  U
UU RB                  U RD                  U RF                  US9u  nnnnUSS2S4   UU'   US   UU'   U R6                  RI                  US   5        M     US:X  a)  U R6                  S   U l        US   U l        US   U l%        OUU l        UU l%        U RM                  XU5        [O        S U R4                  U RP                  4 5       5      (       d  [S        S5      eU $ )a  Fit model with coordinate descent.

Parameters
----------
X : {ndarray, sparse matrix, sparse array} of (n_samples, n_features)
    Data.

    Note that large sparse matrices and arrays requiring `int64`
    indices are not accepted.

y : ndarray of shape (n_samples,) or (n_samples, n_targets)
    Target. Will be cast to X's dtype if necessary.

sample_weight : float or array-like of shape (n_samples,), default=None
    Sample weights. Internally, the `sample_weight` vector will be
    rescaled to sum to `n_samples`.

    .. versionadded:: 0.23

check_input : bool, default=True
    Allow to bypass several input checking.
    Don't use this parameter unless you know what you do.

Returns
-------
self : object
    Fitted estimator.

Notes
-----
Coordinate descent is an algorithm that considers each column of
data at a time hence it will automatically convert the X input
as a Fortran-contiguous numpy array if necessary.

To avoid memory re-allocation it is advised to allocate the
initial data in memory directly using that format.
r   zjWith alpha=0, this algorithm does not converge well. You are advised to use the LinearRegression estimatorr   )
stacklevelFr/   r.   T)r   r3   r   force_writeableaccept_large_sparser1   r   	y_numeric)r3   r1   r   r   Nr   )rF   r1   rH   rG   r2   r'   r   r   )r^   r_   r`   rq   rr   r]   ra   rs   rp   rt   ru   rH   r   rc   r   r   r   r   rG   c              3   j   #    U  H)  n[         R                  " U5      R                  5       v   M+     g 7fr   )r8   isfiniteall).0r   s     r?   	<genexpr>!ElasticNet.fit.<locals>.<genexpr>c  s&     O1NA2;;q>%%''1Ns   13zCoordinate descent iterations resulted in non-finite parameter values. The input data may contain large values and need to be preprocessed.)*r   warningswarnra   rF   r&   r8   rY   r   r   r   r   rU   r   numbersNumberr    rR   r*   rr   r@   rO   rT   r   hasattrr   r   r   rangepathr^   ru   r   r   r   r   r   r   _set_interceptr   
intercept_r4   )r   r:   r;   rG   rH   X_copiedrf   r   r   should_copyrc   y_offsetr   rr   r]   r   r   
dual_gaps_kthis_Xyrd   	this_coefthis_dual_gap	this_iters                           r?   fitElasticNet.fit  sx   N ::?MM    {{9t'9'9H #zz2::. $$)!DA 5A !"	

mW^^44 M$ 4]QWW U8 *9N-NOM kk2(l<DOO,,#'	=
9h'r -3a#.DA66Q;!RZZ- A>bgglArzzM"BGGAJ	gdG&<&<HHi4AGG3OEJJEzzQbjj!m,XXiww7
y!A~QT(59YY!Q$w%("!HH!!....+- 6? 62Ay-0 !AE!H)!,JqMLL	!-? "B ><<?DLqDJ']DNDJ'DNH8 O$**doo1NOOO$  rA   c                 B    [         R                  " U R                  5      $ )z,Sparse representation of the fitted `coef_`.)r	   
csr_matrixr   r   s    r?   sparse_coef_ElasticNet.sparse_coef_m  s       ,,rA   c                    > [        U 5        [        R                  " U5      (       a+  [        XR                  R
                  SS9U R                  -   $ [        TU ]!  U5      $ )zDecision function of the linear model.

Parameters
----------
X : numpy array or scipy.sparse matrix of shape (n_samples, n_features)

Returns
-------
T : ndarray of shape (n_samples,)
    The predicted decision function.
TrJ   )	r"   r	   r6   r   r   rQ   r   super_decision_function)r   r:   	__class__s     r?   r   ElasticNet._decision_functionr  sJ     	??1"1jjllFXX7-a00rA   c                 F   > [         TU ]  5       nSUR                  l        U$ NT)r   __sklearn_tags__
input_tagsr	   r   tagsr   s     r?   r   ElasticNet.__sklearn_tags__  s!    w')!%rA   )r   r   ra   r   rF   r^   r   r   ru   rr   r   r   r   r   rB   r   )__name__
__module____qualname____firstlineno____doc__r
   UNUSED"_ElasticNet__metadata_request__fitr   r   r   r   r   dict__annotations__staticmethodry   r   r   r   r   propertyr   r   r   __static_attributes____classcell__r   s   @r?   r   r     s!   Z|  -.>.E.EF 4D89dAq89# ,/h4?F+q$v67 kK'( (H!567$D  	"D # #6 5G 6GR - -1$ rA   r   c                      ^  \ rS rSr% Sr0 \R                  Er\\S'   \R                  S5        \
" \5      r SSSSSSSSS	S
S.	U 4S jjjrSrU =r$ )Lassoi  a  Linear Model trained with L1 prior as regularizer (aka the Lasso).

The optimization objective for Lasso is::

    (1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1

Technically the Lasso model is optimizing the same objective function as
the Elastic Net with ``l1_ratio=1.0`` (no L2 penalty).

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

Parameters
----------
alpha : float, default=1.0
    Constant that multiplies the L1 term, controlling regularization
    strength. `alpha` must be a non-negative float i.e. in `[0, inf)`.

    When `alpha = 0`, the objective is equivalent to ordinary least
    squares, solved by the :class:`LinearRegression` object. For numerical
    reasons, using `alpha = 0` with the `Lasso` object is not advised.
    Instead, you should use the :class:`LinearRegression` object.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to False, no intercept will be used in calculations
    (i.e. data is expected to be centered).

precompute : bool or array-like of shape (n_features, n_features),                 default=False
    Whether to use a precomputed Gram matrix to speed up
    calculations. The Gram matrix can also be passed as argument.
    For sparse input this option is always ``False`` to preserve sparsity.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``, see Notes below.

warm_start : bool, default=False
    When set to True, reuse the solution of the previous call to fit as
    initialization, otherwise, just erase the previous solution.
    See :term:`the Glossary <warm_start>`.

positive : bool, default=False
    When set to ``True``, forces the coefficients to be positive.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
    Parameter vector (w in the cost function formula).

dual_gap_ : float or ndarray of shape (n_targets,)
    Given param alpha, the dual gaps at the end of the optimization,
    same shape as each observation of y.

sparse_coef_ : sparse matrix of shape (n_features, 1) or             (n_targets, n_features)
    Readonly property derived from ``coef_``.

intercept_ : float or ndarray of shape (n_targets,)
    Independent term in decision function.

n_iter_ : int or list of int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
lars_path : Regularization path using LARS.
lasso_path : Regularization path using Lasso.
LassoLars : Lasso Path along the regularization parameter using LARS algorithm.
LassoCV : Lasso alpha parameter by cross-validation.
LassoLarsCV : Lasso least angle parameter algorithm by cross-validation.
sklearn.decomposition.sparse_encode : Sparse coding array estimator.

Notes
-----
The algorithm used to fit the model is coordinate descent.

To avoid unnecessary memory duplication the X argument of the fit method
should be directly passed as a Fortran-contiguous numpy array.

Regularization improves the conditioning of the problem and
reduces the variance of the estimates. Larger values specify stronger
regularization. Alpha corresponds to `1 / (2C)` in other linear
models such as :class:`~sklearn.linear_model.LogisticRegression` or
:class:`~sklearn.svm.LinearSVC`.

The precise stopping criteria based on `tol` are the following: First, check that
that maximum coordinate update, i.e. :math:`\max_j |w_j^{new} - w_j^{old}|`
is smaller than `tol` times the maximum absolute coefficient, :math:`\max_j |w_j|`.
If so, then additionally check whether the dual gap is smaller than `tol` times
:math:`||y||_2^2 / n_{\text{samples}}`.

The target can be a 2-dimensional array, resulting in the optimization of the
following objective::

    (1 / (2 * n_samples)) * ||Y - XW||^2_F + alpha * ||W||_11

where :math:`||W||_{1,1}` is the sum of the magnitude of the matrix coefficients.
It should not be confused with :class:`~sklearn.linear_model.MultiTaskLasso` which
instead penalizes the :math:`L_{2,1}` norm of the coefficients, yielding row-wise
sparsity in the coefficients.

Examples
--------
>>> from sklearn import linear_model
>>> clf = linear_model.Lasso(alpha=0.1)
>>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2])
Lasso(alpha=0.1)
>>> print(clf.coef_)
[0.85 0.  ]
>>> print(clf.intercept_)
0.15

-   :ref:`sphx_glr_auto_examples_linear_model_plot_lasso_and_elasticnet.py`
    compares Lasso with other L1-based regression models (ElasticNet and ARD
    Regression) for sparse signal recovery in the presence of noise and
    feature correlation.
r   r^   TFr   r   Nr   )	rF   rr   ra   r   r   r   ru   r   r   c       	         4   > [         TU ]  USUUUUUUUU	U
S9  g )NrB   )r   r^   rF   rr   ra   r   r   r   ru   r   r   r   r   )r   r   rF   rr   ra   r   r   r   ru   r   r   r   s              r?   r   Lasso.__init__-  s8     	'!!% 	 	
rA    r   )r   r   r   r   r   r   r   r  r  r   r  ry   r   r   r  r  r	  s   @r?   r  r    sr    Un$

+
+$D  z*	"D 
 
 
rA   r  c           
      P   X   nX   nX   nX   nUc  Su  nnO3X#   nX$   nUR                   S   nUU[        R                  " U5      -  -  n[        R                  " U 5      (       dJ  X4X4X4X44 H<  u  nnUR
                  ULd  M  UR                  S   (       a  M-  UR                  SS9  M>     UR                  S:X  a  US   nOS	n[        UUSUUS	US
9u  pnnnnnUR                  5       nUUS'   UUS'   UUS'   UUS'   S	US'   XS'   UUS'   SU;   a  XS'   [        USXS9nU" X40 UD6u  nnnAAUR                  S:X  aG  U[        R                  SS2SS24   n[        R                  " U5      nUSS2[        R                  4   nUSS2[        R                  4   [        R                  " UU5      -
  n[        UU5      nUUSS2SS2[        R                  4   -
  nUU-  nUc  US-  R!                  SS9nO[        R"                  " US-  USS9nUR!                  SS9$ )a	  Returns the MSE for the models computed by 'path'.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data.

y : array-like of shape (n_samples,) or (n_samples, n_targets)
    Target values.

sample_weight : None or array-like of shape (n_samples,)
    Sample weights.

train : list of indices
    The indices of the train set.

test : list of indices
    The indices of the test set.

path : callable
    Function returning a list of models on the path. See
    enet_path for an example of signature.

path_params : dictionary
    Parameters passed to the path function.

alphas : array-like, default=None
    Array of float that is used for cross-validation. If not
    provided, computed using 'path'.

l1_ratio : float, default=1
    float between 0 and 1 passed to ElasticNet (scaling between
    l1 and l2 penalties). For ``l1_ratio = 0`` the penalty is an
    L2 penalty. For ``l1_ratio = 1`` it is an L1 penalty. For ``0
    < l1_ratio < 1``, the penalty is a combination of L1 and L2.

X_order : {'F', 'C'}, default=None
    The order of the arrays expected by the path function to
    avoid memory copies.

dtype : a numpy dtype, default=None
    The dtype of the arrays expected by the path function to
    avoid memory copies.
N)NNr   	WRITEABLET)r   r'   rr   F)rF   r1   rG   r]   rc   r   ra   rq   rG   r^   r/   )r   r   r3   r   rL   )weightsrM   )rU   r8   rR   r	   r6   baseflagssetflagsrO   r*   r1   r   rT   
atleast_1drS   r   meanaverage) r:   r;   rG   traintestrF   r   path_paramsrq   r^   X_orderr   X_trainy_trainX_testy_testsw_trainsw_testrf   arrayarray_inputrr   rc   r   r   r]   r   rd   
interceptsX_test_coefsresiduesthis_mses                                    r?   _path_residualsr)  N  s{   t hGhGWFWF&' '%MM!$	 	Ix 000 ??1LLKK	#
E; zz,U[[5M5M T*#
 	vv{ .
 
DL#EAGh':r ""$KK&K
$K	 *K!K"#+K [ "*J 'eSGG<<FE1vv{bjj!Q&'==*2::&!RZZ-(266(E+BBJ"651LfQ2::%566H
HaK%%1%-::hk7C==a=  rA   c                     ^  \ rS rSr% Sr\" \SSSS9/\" \SSSS9\" \	" S	15      5      /\" \SSSS9S
S\" \	" S15      5      /S/\	" S15      S
S/\" \SSSS9/\" \SSSS9/S/S/S/\S/S/S/\	" SS15      /S.r
\\S'   \              SS j5       r\S 5       r\S 5       r\\S 5       5       r\" SS9S S j5       rS rU 4S jrSrU =r$ )!LinearModelCVi  zCBase class for iterative model fitting along a regularization path.r   Nrj   rk   r'   rm   
deprecatedri   r   ro   rn   	cv_objectrp   r   r   r   r_   r`   rq   rF   rr   r   r   ra   cvrp   n_jobsru   r   r   r   Tc                     Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        Xl        g r   r.  )r   r_   r`   rq   rF   rr   r   r   ra   r/  rp   r0  ru   r   r   s                  r?   r   LinearModelCV.__init__  sL    $  *$  ("rA   c                     g)z<Model to be fitted after the best alpha has been determined.Nr  r   s    r?   _get_estimatorLinearModelCV._get_estimator      rA   c                     g)z>Bool indicating if class is meant for multidimensional target.Nr  r   s    r?   _is_multitaskLinearModelCV._is_multitask  r6  rA   c                     g)z%Compute path with coordinate descent.Nr  )r:   r;   kwargss      r?   r   LinearModelCV.path"  r6  rA   rv   c                   ^ ^^^^#^$ [        UT S5        T R                  S:X  a  ST l        O,[        R                  " S[
        5        T R                  T l        [        T R                  [        5      (       a  T R                  S:X  a  O:T R                  c  [        R                  " S[
        5        OT R                  T l        T R                  =(       a    T R                  n[        S[        R                  [        R                  /SS	9n[        T[        R                  5      (       d  [         R"                  " T5      (       a  Tn[        S
[        R                  [        R                  /SSSS9n[%        T TTX4S9u  mm[         R"                  " T5      (       aD  ['        US5      (       a2  [        R(                  " UR*                  TR*                  5      (       d  SnO[        R(                  " UT5      (       d  SnAO=[        S
[        R                  [        R                  /SSUS9n[%        T TTX4S9u  mmSn[-        TT5        T R/                  5       (       dP  TR0                  S:  a5  TR2                  S   S:  a"  [5        ST R6                  R8                  -  5      e[;        TSS9mO[[         R"                  " T5      (       a  [=        S5      eTR0                  S:X  a%  [5        ST R6                  R8                  SS -  5      e[        T[>        R@                  5      (       a  SmTb  [C        TTTRD                  S9mT RG                  5       n	T RI                  5       m$T$RK                  SS5        ST$;   a"  [        RL                  " T$S   5      n
U
S   T$S'   OS/n
T$RK                  SS5        T$RK                  SS5        [O        U
5      n[Q        [R        [T        SSS9n[        T R                  [V        5      (       aI  U
 Vs/ s H;  n[Y        TTUT R                  T RZ                  T R                  T R                  TS 9PM=     nnOi[]        T R                  5       H  u  nnU" US!U S"35        M     [        R^                  " [        R`                  " T R                  5      SSS#2   US45      n[O        US   5      nT$Rc                  S$U05        UT$S%'   [e        T Rf                  5      S:  a  ST$S%'   [i        T Rj                  5      n[m        5       (       ap  [o        U5      Rq                  S&S'/S(9nTb#  U(       d  [s        T S'5      (       d  [5        S)5      eU(       a  TUS''   [u        T S40 UD6nTb  [s        T S'5      (       d  SmO [w        5       n[w        [w        5       S*9Ul<        [{        UR|                  " TT40 URx                  R|                  D65      m#[        R~                  nUU#U$UU U4S+ j[        X5       5       n[        T Rf                  T R                  S,S-9" U5      n[        R                  " UU[O        T#5      S#45      n[        R                  " USS.9n[        R                  " [        R                  " US/S5      5      T lG        [        XU5       H3  u  nnn[        R                  " U5      nUU   nUU:  d  M*  UU   nUnUnM5     WT lI        WT lJ        [        T R                  [V        5      (       a6  [        R                  " U5      T lL        US:X  a  T R                  S   T lL        O[        R                  " US   5      T lL        T RI                  5       R                  5        VV s0 s H  u  nn UU	RI                  5       ;   d  M  UU _M!     n!nn U	R                  " S30 U!D6  UU	lO        UU	lP        XYl	        [        T S0S5      n"[        U"[        5      (       a  U"S1:X  a  SU	lR        Tc  U	R                  TT5        OU	R                  TTTS29  ['        T S5      (       d  T ?IU	R                  T lT        U	R                  T lU        U	R                  T lV        U	R                  T lW        T $ s  snf s  sn nf )4a  Fit linear model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data. Pass directly as Fortran-contiguous data
    to avoid unnecessary memory duplication. If y is mono-output,
    X can be sparse. Note that large sparse matrices and arrays
    requiring `int64` indices are not accepted.

y : array-like of shape (n_samples,) or (n_samples, n_targets)
    Target values.

sample_weight : float or array-like of shape (n_samples,),                 default=None
    Sample weights used for fitting and evaluation of the weighted
    mean squared error of each cv-fold. Note that the cross validated
    MSE that is finally used to find the best model is the unweighted
    mean over the (weighted) MSEs of each test fold.

**params : dict, default=None
    Parameters to be passed to the CV splitter.

    .. versionadded:: 1.4
        Only available if `enable_metadata_routing=True`,
        which can be set by using
        ``sklearn.set_config(enable_metadata_routing=True)``.
        See :ref:`Metadata Routing User Guide <metadata_routing>` for
        more details.

Returns
-------
self : object
    Returns an instance of fitted model.
r   r,  rD   a6  'n_alphas' was deprecated in 1.7 and will be removed in 1.9. 'alphas' now accepts an integer value which removes the need to pass 'n_alphas'. The default value of 'alphas' will change from None to 100 in 1.9. Pass an explicit value to 'alphas' and leave 'n_alphas' to its default value to silence this warning.r   Nz'alphas=None' is deprecated and will be removed in 1.9, at which point the default value will be set to 100. Set 'alphas=100' to silence this warning.F)r1   r   r   r/   T)r   r   r   r1   r   validate_separatelyr   r.   )r   r   r3   r   r1   r'   z'For multi-task outputs, use MultiTask%s)r   z/X should be dense but a sparse matrix waspassedzFor mono-task outputs, use %sCV	   r   rF   r^   r   r/  r0  r|   rm   )target_typemin_valinclude_boundaries)r^   rF   r_   r`   ra   rG   zalphas[]rI   r`   ra   splitrG   )methodrz   zGThe CV splitter and underlying estimator do not support sample weights.)rE  c              3      >#    U  HY  u  pT  HM  u  p4[        [        5      " TT
TUUT	R                  T	R                  TUUS TR                  R
                  S9v   MO     M[     g7f)r.   )rq   r^   r  r   N)r   r)  rF   r   r   r   )r   this_l1_ratiothis_alphasr  r  r:   foldsr  rG   r   r;   s        r?   r   $LinearModelCV.fit.<locals>.<genexpr>   sr      
 /E*$ O$""		"&ggll  % /Es   A!A$threads)r0  rp   preferrL   r   rr   rn   )rG   r  )Xr   r`   _alphasr   r   FutureWarningr   rq   strra   rF   r  r8   rY   r   r   r	   r6   r&   r   may_share_memoryr   r!   r8  rO   rU   r4   r   r   r$   	TypeErrorr   r   r    r   r4  
get_paramsr   r  r   r   r   r   r   rh   r_   r   tiler   updater   r0  r   r/  r   r   consumesr%   r   r   splitterlistrE  infzipr   rp   rP   r  squeezemoveaxis	mse_path_argmin	l1_ratio_alpha_r9   alphas_items
set_paramsr   r^   getattrrr   r   r   r   r   r   )%r   r:   r;   rG   rz   ra   check_y_paramsreference_to_old_Xcheck_X_paramsr   	l1_ratios
n_l1_ratiocheck_scalar_alphar^   rq   indexr   r`   r/  splitter_supports_sample_weightrouted_paramsbest_msejobs	mse_pathsmean_mse	l1_alphas
mse_alphasi_best_alphathis_best_mse
best_alphabest_l1_rationamevaluecommon_paramsrr   rJ  r  s%   ````                               @@r?   r   LinearModelCV.fit'  s   N 	&$.
 ==L(DLMM@
   ==DLdkk3''DKK6,A [[ MM+ 	  ;;DL 3!3!3rzz2::6%
 a$$(:(:!" "#zz2::. $$)N !a0PDAq q!!-v66r?R?R&++QVV@ @ #F(();Q??" "#zz2::. $N !a0PDAq F1%!!##vvzaggaj1n =@W@WW  QT*Aq!! QRR1 58O8OPQPR8SS  mW^^44 M$0QM##% oo' 	.$k*&=>I&/lK
# I 	d#$'^
$%	
 dllH-- !* !*H %"&"4"4!\\;;"/	 !*  F !*$,, 7u"5GE7!*<= !8 WWRWWT\\24R48:q/JF vay>J12 &H DKK(1,$)K! dgg.DR.H.Q.Q'8 /R /+ )7)$@@ ' 
 /*7'+D%B6BM(1Bo2 2 !%!GM%*%9M" RXXaCm&<&<&B&BCD66
 
 /2).D
$ ;;LL
 		
 JJy:s5z2*FG	7791-BKK	1a$@A/29h/O+Hi99Z0L&|4Mx'&|4
 (( 0P ' dllH--::f-DLQ#||A ::fQi0DL
  $0668
8eu'')) D%K8 	 

 	)=) &T<6
j#&&:+?$E  IIaOIIa-I8tZ(([[
**}}Ub
s   Aa79a<a<c                     [        U R                  R                  S9R                  U 5      R	                  [        U R                  5      [        5       R	                  SSS9S9nU$ )a"  Get metadata routing of this object.

Please check :ref:`User Guide <metadata_routing>` on how the routing
mechanism works.

.. versionadded:: 1.4

Returns
-------
routing : MetadataRouter
    A :class:`~sklearn.utils.metadata_routing.MetadataRouter` encapsulating
    routing information.
)ownerr   rE  )callercallee)rW  method_mapping)r   r   r   add_self_requestaddr   r/  r   )r   routers     r?   get_metadata_routing"LinearModelCV.get_metadata_routingi  s]     !8!89d#S!$''*,22%2P   	 rA   c                    > [         TU ]  5       nU R                  5       nU(       + UR                  l        X!R
                  l        U$ r   )r   r   r8  r   r	   target_tagsr   )r   r   	multitaskr   s      r?   r   LinearModelCV.__sklearn_tags__  s=    w')&&(	%.(1%rA   )rN  r`  rq   ra  r   ra   r/  r   r_   rF   r   r_  r   r]  r`   r   r0  ru   rr   r   r   r   rp   )rC   r,  r   Trn   r   r   TNFNFNr   r   )r   r   r   r   r   r   r   r   r   r   r   r  r  r   r   r4  r8  r  r   r   r   r  r   r  r  r	  s   @r?   r+  r+    s   M q$y9:Xq$v6:|n-.
 Xq$v6:vh'(	
 $!6(+\9Eh4?@q$v67+m;T"K'( (H!567/$D 4  # #@ K K M M 4  4 5 6B
0 rA   r+  c                   z   ^  \ rS rSrSr\" \5      rSSSSSSS	SS
SS
SS
SS.U 4S jjrS r	S r
SU 4S jjrSrU =r$ )LassoCVi  a  Lasso linear model with iterative fitting along a regularization path.

See glossary entry for :term:`cross-validation estimator`.

The best model is selected by cross-validation.

The optimization objective for Lasso is::

    (1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1

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

Parameters
----------
eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``.

n_alphas : int, default=100
    Number of alphas along the regularization path.

    .. deprecated:: 1.7
        `n_alphas` was deprecated in 1.7 and will be removed in 1.9. Use `alphas`
        instead.

alphas : array-like or int, default=None
    Values of alphas to test along the regularization path.
    If int, `alphas` values are generated automatically.
    If array-like, list of alpha values to use.

    .. versionchanged:: 1.7
        `alphas` accepts an integer value which removes the need to pass
        `n_alphas`.

    .. deprecated:: 1.7
        `alphas=None` was deprecated in 1.7 and will be removed in 1.9, at which
        point the default value will be set to 100.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to false, no intercept will be used in calculations
    (i.e. data is expected to be centered).

precompute : 'auto', bool or array-like of shape             (n_features, n_features), default='auto'
    Whether to use a precomputed Gram matrix to speed up
    calculations. If set to ``'auto'`` let us decide. The Gram
    matrix can also be passed as argument.

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

cv : int, cross-validation generator or iterable, default=None
    Determines the cross-validation splitting strategy.
    Possible inputs for cv are:

    - None, to use the default 5-fold cross-validation,
    - int, to specify the number of folds.
    - :term:`CV splitter`,
    - An iterable yielding (train, test) splits as arrays of indices.

    For int/None inputs, :class:`~sklearn.model_selection.KFold` is used.

    Refer :ref:`User Guide <cross_validation>` for the various
    cross-validation strategies that can be used here.

    .. versionchanged:: 0.22
        ``cv`` default value if None changed from 3-fold to 5-fold.

verbose : bool or int, default=False
    Amount of verbosity.

n_jobs : int, default=None
    Number of CPUs to use during the cross validation.
    ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
    ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
    for more details.

positive : bool, default=False
    If positive, restrict regression coefficients to be positive.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
alpha_ : float
    The amount of penalization chosen by cross validation.

coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
    Parameter vector (w in the cost function formula).

intercept_ : float or ndarray of shape (n_targets,)
    Independent term in decision function.

mse_path_ : ndarray of shape (n_alphas, n_folds)
    Mean square error for the test set on each fold, varying alpha.

alphas_ : ndarray of shape (n_alphas,)
    The grid of alphas used for fitting.

dual_gap_ : float or ndarray of shape (n_targets,)
    The dual gap at the end of the optimization for the optimal alpha
    (``alpha_``).

n_iter_ : int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance for the optimal alpha.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
lars_path : Compute Least Angle Regression or Lasso path using LARS
    algorithm.
lasso_path : Compute Lasso path with coordinate descent.
Lasso : The Lasso is a linear model that estimates sparse coefficients.
LassoLars : Lasso model fit with Least Angle Regression a.k.a. Lars.
LassoCV : Lasso linear model with iterative fitting along a regularization
    path.
LassoLarsCV : Cross-validated Lasso using the LARS algorithm.

Notes
-----
In `fit`, once the best parameter `alpha` is found through
cross-validation, the model is fit again using the entire training set.

To avoid unnecessary memory duplication the `X` argument of the `fit`
method should be directly passed as a Fortran-contiguous numpy array.

For an example, see :ref:`examples/linear_model/plot_lasso_model_selection.py
<sphx_glr_auto_examples_linear_model_plot_lasso_model_selection.py>`.

:class:`LassoCV` leads to different results than a hyperparameter
search using :class:`~sklearn.model_selection.GridSearchCV` with a
:class:`Lasso` model. In :class:`LassoCV`, a model for a given
penalty `alpha` is warm started using the coefficients of the
closest model (trained at the previous iteration) on the
regularization path. It tends to speed up the hyperparameter
search.

Examples
--------
>>> from sklearn.linear_model import LassoCV
>>> from sklearn.datasets import make_regression
>>> X, y = make_regression(noise=4, random_state=0)
>>> reg = LassoCV(cv=5, random_state=0).fit(X, y)
>>> reg.score(X, y)
0.9993
>>> reg.predict(X[:1,])
array([-78.4951])
rC   r,  r   Trn   r   r   NFr   r.  c                :   > [         TU ]  UUUUUUUUU	U
UUUUS9  g )Nr.  r  )r   r_   r`   rq   rF   rr   r   r   ra   r/  rp   r0  ru   r   r   r   s                  r?   r   LassoCV.__init__@  sA    $ 	'!% 	 	
rA   c                     [        5       $ r   )r  r   s    r?   r4  LassoCV._get_estimatorc  s	    wrA   c                     gNFr  r   s    r?   r8  LassoCV._is_multitaskf      rA   c                 *   > [         TU ]  " X4SU0UD6$ )a  Fit Lasso model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data. Pass directly as Fortran-contiguous data
    to avoid unnecessary memory duplication. If y is mono-output,
    X can be sparse. Note that large sparse matrices and arrays
    requiring `int64` indices are not accepted.

y : array-like of shape (n_samples,)
    Target values.

sample_weight : float or array-like of shape (n_samples,),                 default=None
    Sample weights used for fitting and evaluation of the weighted
    mean squared error of each cv-fold. Note that the cross validated
    MSE that is finally used to find the best model is the unweighted
    mean over the (weighted) MSEs of each test fold.

**params : dict, default=None
    Parameters to be passed to the CV splitter.

    .. versionadded:: 1.4
        Only available if `enable_metadata_routing=True`,
        which can be set by using
        ``sklearn.set_config(enable_metadata_routing=True)``.
        See :ref:`Metadata Routing User Guide <metadata_routing>` for
        more details.

Returns
-------
self : object
    Returns an instance of fitted model.
rG   r   r   r   r:   r;   rG   rz   r   s        r?   r   LassoCV.fiti      L w{1G}GGGrA   r  r   )r   r   r   r   r   r  r{   r   r   r4  r8  r   r  r  r	  s   @r?   r  r    sc    rh 
#D
 !!
 !
F&H &HrA   r  c                      ^  \ rS rSr% Sr0 \R                  ES\" \SSSS9S/0Er\	\
S	'   \" \5      rS
SSSSSSSSSSSSSSS.S jrS rS rSU 4S jjrSrU =r$ )ElasticNetCVi  a  Elastic Net model with iterative fitting along a regularization path.

See glossary entry for :term:`cross-validation estimator`.

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

Parameters
----------
l1_ratio : float or list of float, default=0.5
    Float between 0 and 1 passed to ElasticNet (scaling between
    l1 and l2 penalties). For ``l1_ratio = 0``
    the penalty is an L2 penalty. For ``l1_ratio = 1`` it is an L1 penalty.
    For ``0 < l1_ratio < 1``, the penalty is a combination of L1 and L2
    This parameter can be a list, in which case the different
    values are tested by cross-validation and the one giving the best
    prediction score is used. Note that a good choice of list of
    values for l1_ratio is often to put more values close to 1
    (i.e. Lasso) and less close to 0 (i.e. Ridge), as in ``[.1, .5, .7,
    .9, .95, .99, 1]``.

eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``.

n_alphas : int, default=100
    Number of alphas along the regularization path, used for each l1_ratio.

    .. deprecated:: 1.7
        `n_alphas` was deprecated in 1.7 and will be removed in 1.9. Use `alphas`
        instead.

alphas : array-like or int, default=None
    Values of alphas to test along the regularization path, used for each l1_ratio.
    If int, `alphas` values are generated automatically.
    If array-like, list of alpha values to use.

    .. versionchanged:: 1.7
        `alphas` accepts an integer value which removes the need to pass
        `n_alphas`.

    .. deprecated:: 1.7
        `alphas=None` was deprecated in 1.7 and will be removed in 1.9, at which
        point the default value will be set to 100.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to false, no intercept will be used in calculations
    (i.e. data is expected to be centered).

precompute : 'auto', bool or array-like of shape             (n_features, n_features), default='auto'
    Whether to use a precomputed Gram matrix to speed up
    calculations. If set to ``'auto'`` let us decide. The Gram
    matrix can also be passed as argument.

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``.

cv : int, cross-validation generator or iterable, default=None
    Determines the cross-validation splitting strategy.
    Possible inputs for cv are:

    - None, to use the default 5-fold cross-validation,
    - int, to specify the number of folds.
    - :term:`CV splitter`,
    - An iterable yielding (train, test) splits as arrays of indices.

    For int/None inputs, :class:`~sklearn.model_selection.KFold` is used.

    Refer :ref:`User Guide <cross_validation>` for the various
    cross-validation strategies that can be used here.

    .. versionchanged:: 0.22
        ``cv`` default value if None changed from 3-fold to 5-fold.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

verbose : bool or int, default=0
    Amount of verbosity.

n_jobs : int, default=None
    Number of CPUs to use during the cross validation.
    ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
    ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
    for more details.

positive : bool, default=False
    When set to ``True``, forces the coefficients to be positive.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
alpha_ : float
    The amount of penalization chosen by cross validation.

l1_ratio_ : float
    The compromise between l1 and l2 penalization chosen by
    cross validation.

coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
    Parameter vector (w in the cost function formula).

intercept_ : float or ndarray of shape (n_targets, n_features)
    Independent term in the decision function.

mse_path_ : ndarray of shape (n_l1_ratio, n_alpha, n_folds)
    Mean square error for the test set on each fold, varying l1_ratio and
    alpha.

alphas_ : ndarray of shape (n_alphas,) or (n_l1_ratio, n_alphas)
    The grid of alphas used for fitting, for each l1_ratio.

dual_gap_ : float
    The dual gaps at the end of the optimization for the optimal alpha.

n_iter_ : int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance for the optimal alpha.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
enet_path : Compute elastic net path with coordinate descent.
ElasticNet : Linear regression with combined L1 and L2 priors as regularizer.

Notes
-----
In `fit`, once the best parameters `l1_ratio` and `alpha` are found through
cross-validation, the model is fit again using the entire training set.

To avoid unnecessary memory duplication the `X` argument of the `fit`
method should be directly passed as a Fortran-contiguous numpy array.

The parameter `l1_ratio` corresponds to alpha in the glmnet R package
while alpha corresponds to the lambda parameter in glmnet.
More specifically, the optimization objective is::

    1 / (2 * n_samples) * ||y - Xw||^2_2
    + alpha * l1_ratio * ||w||_1
    + 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2

If you are interested in controlling the L1 and L2 penalty
separately, keep in mind that this is equivalent to::

    a * L1 + b * L2

for::

    alpha = a + b and l1_ratio = a / (a + b).

For an example, see
:ref:`examples/linear_model/plot_lasso_model_selection.py
<sphx_glr_auto_examples_linear_model_plot_lasso_model_selection.py>`.

Examples
--------
>>> from sklearn.linear_model import ElasticNetCV
>>> from sklearn.datasets import make_regression

>>> X, y = make_regression(n_features=2, random_state=0)
>>> regr = ElasticNetCV(cv=5, random_state=0)
>>> regr.fit(X, y)
ElasticNetCV(cv=5, random_state=0)
>>> print(regr.alpha_)
0.199
>>> print(regr.intercept_)
0.398
>>> print(regr.predict([[0, 0]]))
[0.398]
r^   r   r'   r}   rk   ri   r   r~   rC   r,  r   Trn   r   r   NFr   r^   r_   r`   rq   rF   rr   r   r   r/  ra   rp   r0  ru   r   r   c                    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        Xl        Xl        g r   r  )r   r^   r_   r`   rq   rF   rr   r   r   r/  ra   rp   r0  ru   r   r   s                   r?   r   ElasticNetCV.__init__a	  sQ    & ! *$  ("rA   c                     [        5       $ r   )r   r   s    r?   r4  ElasticNetCV._get_estimator	  s
    |rA   c                     gr  r  r   s    r?   r8  ElasticNetCV._is_multitask	  r  rA   c                 *   > [         TU ]  " X4SU0UD6$ )a  Fit ElasticNet model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.

Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
    Training data. Pass directly as Fortran-contiguous data
    to avoid unnecessary memory duplication. If y is mono-output,
    X can be sparse. Note that large sparse matrices and arrays
    requiring `int64` indices are not accepted.

y : array-like of shape (n_samples,)
    Target values.

sample_weight : float or array-like of shape (n_samples,),                 default=None
    Sample weights used for fitting and evaluation of the weighted
    mean squared error of each cv-fold. Note that the cross validated
    MSE that is finally used to find the best model is the unweighted
    mean over the (weighted) MSEs of each test fold.

**params : dict, default=None
    Parameters to be passed to the CV splitter.

    .. versionadded:: 1.4
        Only available if `enable_metadata_routing=True`,
        which can be set by using
        ``sklearn.set_config(enable_metadata_routing=True)``.
        See :ref:`Metadata Routing User Guide <metadata_routing>` for
        more details.

Returns
-------
self : object
    Returns an instance of fitted model.
rG   r  r  s        r?   r   ElasticNetCV.fit	  r  rA   )rq   ra   r/  r_   rF   r^   r   r`   r0  ru   rr   r   r   r   rp   r   )r   r   r   r   r   r+  r   r   r   r  r  r  ry   r   r   r4  r8  r   r  r  r	  s   @r?   r  r    s    EN$

.
.$XdAq8,G$D 
 	"D
 #!#F&H &HrA   r  c            
          ^  \ rS rSr% Sr0 \R                  Er\\S'   S H  r	\R                  \	5        M      SSSSSSS	S
SS.S jjr\" SS9S 5       rU 4S jrSrU =r$ )MultiTaskElasticNeti	  a  Multi-task ElasticNet model trained with L1/L2 mixed-norm as regularizer.

The optimization objective for MultiTaskElasticNet is::

    (1 / (2 * n_samples)) * ||Y - XW||_Fro^2
    + alpha * l1_ratio * ||W||_21
    + 0.5 * alpha * (1 - l1_ratio) * ||W||_Fro^2

Where::

    ||W||_21 = sum_i sqrt(sum_j W_ij ^ 2)

i.e. the sum of norms of each row.

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

Parameters
----------
alpha : float, default=1.0
    Constant that multiplies the L1/L2 term. Defaults to 1.0.

l1_ratio : float, default=0.5
    The ElasticNet mixing parameter, with 0 < l1_ratio <= 1.
    For l1_ratio = 1 the penalty is an L1/L2 penalty. For l1_ratio = 0 it
    is an L2 penalty.
    For ``0 < l1_ratio < 1``, the penalty is a combination of L1/L2 and L2.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to false, no intercept will be used in calculations
    (i.e. data is expected to be centered).

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``.

warm_start : bool, default=False
    When set to ``True``, reuse the solution of the previous call to fit as
    initialization, otherwise, just erase the previous solution.
    See :term:`the Glossary <warm_start>`.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
intercept_ : ndarray of shape (n_targets,)
    Independent term in decision function.

coef_ : ndarray of shape (n_targets, n_features)
    Parameter vector (W in the cost function formula). If a 1D y is
    passed in at fit (non multi-task usage), ``coef_`` is then a 1D array.
    Note that ``coef_`` stores the transpose of ``W``, ``W.T``.

n_iter_ : int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance.

dual_gap_ : float
    The dual gaps at the end of the optimization.

eps_ : float
    The tolerance scaled scaled by the variance of the target `y`.

sparse_coef_ : sparse matrix of shape (n_features,) or             (n_targets, n_features)
    Sparse representation of the `coef_`.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
MultiTaskElasticNetCV : Multi-task L1/L2 ElasticNet with built-in
    cross-validation.
ElasticNet : Linear regression with combined L1 and L2 priors as regularizer.
MultiTaskLasso : Multi-task Lasso model trained with L1/L2
    mixed-norm as regularizer.

Notes
-----
The algorithm used to fit the model is coordinate descent.

To avoid unnecessary memory duplication the X and y arguments of the fit
method should be directly passed as Fortran-contiguous numpy arrays.

Examples
--------
>>> from sklearn import linear_model
>>> clf = linear_model.MultiTaskElasticNet(alpha=0.1)
>>> clf.fit([[0,0], [1, 1], [2, 2]], [[0, 0], [1, 1], [2, 2]])
MultiTaskElasticNet(alpha=0.1)
>>> print(clf.coef_)
[[0.45663524 0.45612256]
 [0.45663524 0.45612256]]
>>> print(clf.intercept_)
[0.0872422 0.0872422]
r   )rr   ru   r~   Tr   r   FNr   )r^   rF   ra   r   r   r   r   r   c                p    X l         Xl        X0l        XPl        X@l        X`l        Xpl        Xl        Xl        g r   )	r^   r   rF   r   ra   r   r   r   r   )
r   r   r^   rF   ra   r   r   r   r   r   s
             r?   r   MultiTaskElasticNet.__init__:
  s3     !
* $("rA   rv   c                    [        [        R                  [        R                  /SSU R                  =(       a    U R
                  S9n[        SSS9n[        XX#U4S9u  p[        X5        UR                  UR                  5      n[        U S5      (       a  SnOS	nUR                  S
:X  a  [        SU-  5      eUR                  u  pgUR                  S
   n[        XU R
                  SS9u  ppnU R                  (       a  [        U S5      (       d0  [        R                   " X4UR                  R"                  SS9U l        U R&                  U R(                  -  U-  nU R&                  SU R(                  -
  -  U-  n[        R*                  " U R$                  5      U l        U R,                  S:H  n[.        R0                  " U R$                  UUUUU R2                  U R4                  [7        U R8                  5      U5	      u  U l        U l        U l        U l        U =R:                  U-  sl        U RA                  XU5        U $ )aI  Fit MultiTaskElasticNet model with coordinate descent.

Parameters
----------
X : ndarray of shape (n_samples, n_features)
    Data.
y : ndarray of shape (n_samples, n_targets)
    Target. Will be cast to X's dtype if necessary.

Returns
-------
self : object
    Fitted estimator.

Notes
-----
Coordinate descent is an algorithm that considers each column of
data at a time hence it will automatically convert the X input
as a Fortran-contiguous numpy array if necessary.

To avoid memory re-allocation it is advised to allocate the
initial data in memory directly using that format.
r.   T)r   r3   r   r1   F)r   r3   r>  r^   r   r  r'   zFor mono-task outputs, use %s)rF   r1   r   r   rB   r   )!r  r8   rY   r   ra   rF   r&   r!   astyper   r   rO   r4   rU   r+   r   r   r   r   r   r^   r   r   r   r   r   r   r#   r   r   r   r   r   )r   r:   r;   rg  re  	model_strrf   r   r   rc   r   r   r   r   r   s                  r?   r   MultiTaskElasticNet.fitQ
  s   6 ::rzz* 3!3!3	
 S9Q^,L
 	 %HHQWW4$$$II66Q;<yHII !	GGAJ	,< 2 2-
)h' gdG&<&<'qww||3DJ dmm+i7sT]]23i?&&tzz2
8+ 66JJMMHHt001

	
JNIL 	)#H8 rA   c                    > [         TU ]  5       nSUR                  l        SUR                  l        SUR                  l        U$ )NFT)r   r   r   r	   r  r   single_outputr   s     r?   r   $MultiTaskElasticNet.__sklearn_tags__
  s=    w')!&(,%).&rA   )r   r   ra   r   r   rF   r^   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r  r  paramr   r   r   r   r   r  r  r	  s   @r?   r  r  	  s    zx$

+
+$D  ,""5) ,
 # #. 5X 6Xt rA   r  c            	           \ rS rSr% Sr0 \R                  Er\\S'   \R                  S5         SSSSSSS	S
S.S jjr
Srg	)MultiTaskLassoi
  aO  Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

The optimization objective for Lasso is::

    (1 / (2 * n_samples)) * ||Y - XW||^2_Fro + alpha * ||W||_21

Where::

    ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2}

i.e. the sum of norm of each row.

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

Parameters
----------
alpha : float, default=1.0
    Constant that multiplies the L1/L2 term. Defaults to 1.0.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to false, no intercept will be used in calculations
    (i.e. data is expected to be centered).

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``.

warm_start : bool, default=False
    When set to ``True``, reuse the solution of the previous call to fit as
    initialization, otherwise, just erase the previous solution.
    See :term:`the Glossary <warm_start>`.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
coef_ : ndarray of shape (n_targets, n_features)
    Parameter vector (W in the cost function formula).
    Note that ``coef_`` stores the transpose of ``W``, ``W.T``.

intercept_ : ndarray of shape (n_targets,)
    Independent term in decision function.

n_iter_ : int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance.

dual_gap_ : ndarray of shape (n_alphas,)
    The dual gaps at the end of the optimization for each alpha.

eps_ : float
    The tolerance scaled scaled by the variance of the target `y`.

sparse_coef_ : sparse matrix of shape (n_features,) or             (n_targets, n_features)
    Sparse representation of the `coef_`.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
Lasso: Linear Model trained with L1 prior as regularizer (aka the Lasso).
MultiTaskLassoCV: Multi-task L1 regularized linear model with built-in
    cross-validation.
MultiTaskElasticNetCV: Multi-task L1/L2 ElasticNet with built-in cross-validation.

Notes
-----
The algorithm used to fit the model is coordinate descent.

To avoid unnecessary memory duplication the X and y arguments of the fit
method should be directly passed as Fortran-contiguous numpy arrays.

Examples
--------
>>> from sklearn import linear_model
>>> clf = linear_model.MultiTaskLasso(alpha=0.1)
>>> clf.fit([[0, 1], [1, 2], [2, 4]], [[0, 0], [1, 1], [2, 3]])
MultiTaskLasso(alpha=0.1)
>>> print(clf.coef_)
[[0.         0.60809415]
[0.         0.94592424]]
>>> print(clf.intercept_)
[-0.41888636 -0.87382323]
r   r^   Tr   r   FNr   )rF   ra   r   r   r   r   r   c                r    Xl         X l        X@l        X0l        XPl        X`l        SU l        Xpl        Xl        g )NrB   )	r   rF   r   ra   r   r   r^   r   r   )	r   r   rF   ra   r   r   r   r   r   s	            r?   r   MultiTaskLasso.__init__,  s5     
* $("rA   )	r   ra   rF   r^   r   r   r   r   r   r   )r   r   r   r   r   r  r   r  r  r   r   r  r  rA   r?   r  r  
  sa    pd$

4
4$D  z* # # #rA   r  c                      ^  \ rS rSr% Sr0 \R                  ES\" \SSSS9S/0Er\	\
S	'   \R                  S
5        \R                  S5        \" \5      rSSSSSSSSSSSSSS.S jrS rS rU 4S jrU 4S jrSrU =r$ )MultiTaskElasticNetCViC  a  Multi-task L1/L2 ElasticNet with built-in cross-validation.

See glossary entry for :term:`cross-validation estimator`.

The optimization objective for MultiTaskElasticNet is::

    (1 / (2 * n_samples)) * ||Y - XW||^Fro_2
    + alpha * l1_ratio * ||W||_21
    + 0.5 * alpha * (1 - l1_ratio) * ||W||_Fro^2

Where::

    ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2}

i.e. the sum of norm of each row.

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

.. versionadded:: 0.15

Parameters
----------
l1_ratio : float or list of float, default=0.5
    The ElasticNet mixing parameter, with 0 < l1_ratio <= 1.
    For l1_ratio = 1 the penalty is an L1/L2 penalty. For l1_ratio = 0 it
    is an L2 penalty.
    For ``0 < l1_ratio < 1``, the penalty is a combination of L1/L2 and L2.
    This parameter can be a list, in which case the different
    values are tested by cross-validation and the one giving the best
    prediction score is used. Note that a good choice of list of
    values for l1_ratio is often to put more values close to 1
    (i.e. Lasso) and less close to 0 (i.e. Ridge), as in ``[.1, .5, .7,
    .9, .95, .99, 1]``.

eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``.

n_alphas : int, default=100
    Number of alphas along the regularization path.

    .. deprecated:: 1.7
        `n_alphas` was deprecated in 1.7 and will be removed in 1.9. Use `alphas`
        instead.

alphas : array-like or int, default=None
    Values of alphas to test along the regularization path, used for each l1_ratio.
    If int, `alphas` values are generated automatically.
    If array-like, list of alpha values to use.

    .. versionchanged:: 1.7
        `alphas` accepts an integer value which removes the need to pass
        `n_alphas`.

    .. deprecated:: 1.7
        `alphas=None` was deprecated in 1.7 and will be removed in 1.9, at which
        point the default value will be set to 100.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to false, no intercept will be used in calculations
    (i.e. data is expected to be centered).

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``.

cv : int, cross-validation generator or iterable, default=None
    Determines the cross-validation splitting strategy.
    Possible inputs for cv are:

    - None, to use the default 5-fold cross-validation,
    - int, to specify the number of folds.
    - :term:`CV splitter`,
    - An iterable yielding (train, test) splits as arrays of indices.

    For int/None inputs, :class:`~sklearn.model_selection.KFold` is used.

    Refer :ref:`User Guide <cross_validation>` for the various
    cross-validation strategies that can be used here.

    .. versionchanged:: 0.22
        ``cv`` default value if None changed from 3-fold to 5-fold.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

verbose : bool or int, default=0
    Amount of verbosity.

n_jobs : int, default=None
    Number of CPUs to use during the cross validation. Note that this is
    used only if multiple values for l1_ratio are given.
    ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
    ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
    for more details.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
intercept_ : ndarray of shape (n_targets,)
    Independent term in decision function.

coef_ : ndarray of shape (n_targets, n_features)
    Parameter vector (W in the cost function formula).
    Note that ``coef_`` stores the transpose of ``W``, ``W.T``.

alpha_ : float
    The amount of penalization chosen by cross validation.

mse_path_ : ndarray of shape (n_alphas, n_folds) or                 (n_l1_ratio, n_alphas, n_folds)
    Mean square error for the test set on each fold, varying alpha.

alphas_ : ndarray of shape (n_alphas,) or (n_l1_ratio, n_alphas)
    The grid of alphas used for fitting, for each l1_ratio.

l1_ratio_ : float
    Best l1_ratio obtained by cross-validation.

n_iter_ : int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance for the optimal alpha.

dual_gap_ : float
    The dual gap at the end of the optimization for the optimal alpha.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
MultiTaskElasticNet : Multi-task L1/L2 ElasticNet with built-in cross-validation.
ElasticNetCV : Elastic net model with best model selection by
    cross-validation.
MultiTaskLassoCV : Multi-task Lasso model trained with L1 norm
    as regularizer and built-in cross-validation.

Notes
-----
The algorithm used to fit the model is coordinate descent.

In `fit`, once the best parameters `l1_ratio` and `alpha` are found through
cross-validation, the model is fit again using the entire training set.

To avoid unnecessary memory duplication the `X` and `y` arguments of the
`fit` method should be directly passed as Fortran-contiguous numpy arrays.

Examples
--------
>>> from sklearn import linear_model
>>> clf = linear_model.MultiTaskElasticNetCV(cv=3)
>>> clf.fit([[0,0], [1, 1], [2, 2]],
...         [[0, 0], [1, 1], [2, 2]])
MultiTaskElasticNetCV(cv=3)
>>> print(clf.coef_)
[[0.52875032 0.46958558]
 [0.52875032 0.46958558]]
>>> print(clf.intercept_)
[0.00166409 0.00166409]
r^   r   r'   r}   rk   ri   r   rr   ru   r~   rC   r,  r   Tr   r   Nr   r^   r_   r`   rq   rF   r   r   r/  ra   rp   r0  r   r   c                    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        g r   r  )r   r^   r_   r`   rq   rF   r   r   r/  ra   rp   r0  r   r   s                 r?   r   MultiTaskElasticNetCV.__init__  sG    " ! * ("rA   c                     [        5       $ r   )r  r   s    r?   r4  $MultiTaskElasticNetCV._get_estimator&  s    "$$rA   c                     gr   r  r   s    r?   r8  #MultiTaskElasticNetCV._is_multitask)      rA   c                 F   > [         TU ]  5       nSUR                  l        U$ r  r   r   r  r  r   s     r?   r   &MultiTaskElasticNetCV.__sklearn_tags__,  #    w')).&rA   c                 &   > [         TU ]  " X40 UD6$ )a  Fit MultiTaskElasticNet model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.

Parameters
----------
X : ndarray of shape (n_samples, n_features)
    Training data.
y : ndarray of shape (n_samples, n_targets)
    Training target variable. Will be cast to X's dtype if necessary.

**params : dict, default=None
    Parameters to be passed to the CV splitter.

    .. versionadded:: 1.4
        Only available if `enable_metadata_routing=True`,
        which can be set by using
        ``sklearn.set_config(enable_metadata_routing=True)``.
        See :ref:`Metadata Routing User Guide <metadata_routing>` for
        more details.

Returns
-------
self : object
    Returns MultiTaskElasticNet instance.
r  r   r:   r;   rz   r   s       r?   r   MultiTaskElasticNetCV.fit3      6 w{1*6**rA   )rq   ra   r/  r_   rF   r^   r   r`   r0  r   r   r   rp   )r   r   r   r   r   r+  r   r   r   r  r  r   r  ry   r   r   r4  r8  r   r   r  r  r	  s   @r?   r  r  C  s    xt$

.
.$XdAq8,G$D  |,z*	"D
 #>%+ +rA   r  c                      ^  \ rS rSr% Sr0 \R                  Er\\S'   \R                  S5        \R                  S5        \
" \5      rSSSS	S
SS	SSSSSS.U 4S jjrS rS rU 4S jrU 4S jrSrU =r$ )MultiTaskLassoCViQ  a  Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

See glossary entry for :term:`cross-validation estimator`.

The optimization objective for MultiTaskLasso is::

    (1 / (2 * n_samples)) * ||Y - XW||^Fro_2 + alpha * ||W||_21

Where::

    ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2}

i.e. the sum of norm of each row.

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

.. versionadded:: 0.15

Parameters
----------
eps : float, default=1e-3
    Length of the path. ``eps=1e-3`` means that
    ``alpha_min / alpha_max = 1e-3``.

n_alphas : int, default=100
    Number of alphas along the regularization path.

    .. deprecated:: 1.7
        `n_alphas` was deprecated in 1.7 and will be removed in 1.9. Use `alphas`
        instead.

alphas : array-like or int, default=None
    Values of alphas to test along the regularization path.
    If int, `alphas` values are generated automatically.
    If array-like, list of alpha values to use.

    .. versionchanged:: 1.7
        `alphas` accepts an integer value which removes the need to pass
        `n_alphas`.

    .. deprecated:: 1.7
        `alphas=None` was deprecated in 1.7 and will be removed in 1.9, at which
        point the default value will be set to 100.

fit_intercept : bool, default=True
    Whether to calculate the intercept for this model. If set
    to false, no intercept will be used in calculations
    (i.e. data is expected to be centered).

max_iter : int, default=1000
    The maximum number of iterations.

tol : float, default=1e-4
    The tolerance for the optimization: if the updates are
    smaller than ``tol``, the optimization code checks the
    dual gap for optimality and continues until it is smaller
    than ``tol``.

copy_X : bool, default=True
    If ``True``, X will be copied; else, it may be overwritten.

cv : int, cross-validation generator or iterable, default=None
    Determines the cross-validation splitting strategy.
    Possible inputs for cv are:

    - None, to use the default 5-fold cross-validation,
    - int, to specify the number of folds.
    - :term:`CV splitter`,
    - An iterable yielding (train, test) splits as arrays of indices.

    For int/None inputs, :class:`~sklearn.model_selection.KFold` is used.

    Refer :ref:`User Guide <cross_validation>` for the various
    cross-validation strategies that can be used here.

    .. versionchanged:: 0.22
        ``cv`` default value if None changed from 3-fold to 5-fold.

verbose : bool or int, default=False
    Amount of verbosity.

n_jobs : int, default=None
    Number of CPUs to use during the cross validation. Note that this is
    used only if multiple values for l1_ratio are given.
    ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
    ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
    for more details.

random_state : int, RandomState instance, default=None
    The seed of the pseudo random number generator that selects a random
    feature to update. Used when ``selection`` == 'random'.
    Pass an int for reproducible output across multiple function calls.
    See :term:`Glossary <random_state>`.

selection : {'cyclic', 'random'}, default='cyclic'
    If set to 'random', a random coefficient is updated every iteration
    rather than looping over features sequentially by default. This
    (setting to 'random') often leads to significantly faster convergence
    especially when tol is higher than 1e-4.

Attributes
----------
intercept_ : ndarray of shape (n_targets,)
    Independent term in decision function.

coef_ : ndarray of shape (n_targets, n_features)
    Parameter vector (W in the cost function formula).
    Note that ``coef_`` stores the transpose of ``W``, ``W.T``.

alpha_ : float
    The amount of penalization chosen by cross validation.

mse_path_ : ndarray of shape (n_alphas, n_folds)
    Mean square error for the test set on each fold, varying alpha.

alphas_ : ndarray of shape (n_alphas,)
    The grid of alphas used for fitting.

n_iter_ : int
    Number of iterations run by the coordinate descent solver to reach
    the specified tolerance for the optimal alpha.

dual_gap_ : float
    The dual gap at the end of the optimization for the optimal alpha.

n_features_in_ : int
    Number of features seen during :term:`fit`.

    .. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
    Names of features seen during :term:`fit`. Defined only when `X`
    has feature names that are all strings.

    .. versionadded:: 1.0

See Also
--------
MultiTaskElasticNet : Multi-task ElasticNet model trained with L1/L2
    mixed-norm as regularizer.
ElasticNetCV : Elastic net model with best model selection by
    cross-validation.
MultiTaskElasticNetCV : Multi-task L1/L2 ElasticNet with built-in
    cross-validation.

Notes
-----
The algorithm used to fit the model is coordinate descent.

In `fit`, once the best parameter `alpha` is found through
cross-validation, the model is fit again using the entire training set.

To avoid unnecessary memory duplication the `X` and `y` arguments of the
`fit` method should be directly passed as Fortran-contiguous numpy arrays.

Examples
--------
>>> from sklearn.linear_model import MultiTaskLassoCV
>>> from sklearn.datasets import make_regression
>>> from sklearn.metrics import r2_score
>>> X, y = make_regression(n_targets=2, noise=4, random_state=0)
>>> reg = MultiTaskLassoCV(cv=5, random_state=0).fit(X, y)
>>> r2_score(y, reg.predict(X))
0.9994
>>> reg.alpha_
np.float64(0.5713)
>>> reg.predict(X[:1,])
array([[153.7971,  94.9015]])
r   rr   ru   rC   r,  r   Tr   r   NFr   r_   r`   rq   rF   r   r   ra   r/  rp   r0  r   r   c                6   > [         TU ]  UUUUUUUUU	U
UUS9  g )Nr  r  )r   r_   r`   rq   rF   r   r   ra   r/  rp   r0  r   r   r   s                r?   r   MultiTaskLassoCV.__init__  s;      	'% 	 	
rA   c                     [        5       $ r   )r  r   s    r?   r4  MultiTaskLassoCV._get_estimator#  s    rA   c                     gr   r  r   s    r?   r8  MultiTaskLassoCV._is_multitask&  r  rA   c                 F   > [         TU ]  5       nSUR                  l        U$ r  r  r   s     r?   r   !MultiTaskLassoCV.__sklearn_tags__)  r  rA   c                 &   > [         TU ]  " X40 UD6$ )a  Fit MultiTaskLasso model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.

Parameters
----------
X : ndarray of shape (n_samples, n_features)
    Data.
y : ndarray of shape (n_samples, n_targets)
    Target. Will be cast to X's dtype if necessary.

**params : dict, default=None
    Parameters to be passed to the CV splitter.

    .. versionadded:: 1.4
        Only available if `enable_metadata_routing=True`,
        which can be set by using
        ``sklearn.set_config(enable_metadata_routing=True)``.
        See :ref:`Metadata Routing User Guide <metadata_routing>` for
        more details.

Returns
-------
self : object
    Returns an instance of fitted model.
r  r  s       r?   r   MultiTaskLassoCV.fit0  r  rA   r  )r   r   r   r   r   r+  r   r  r  r   r  r{   r   r   r4  r8  r   r   r  r  r	  s   @r?   r  r  Q  s    hT$

.
.$D  |,z*
#D
 
 
> + +rA   r  )r-   )NrB   TrC   rD   TN)Nr'   NN)Kr   r   r   abcr   r   	functoolsr   r   r   numpyr8   joblibr   scipyr	   sklearn.utilsr
   r  r   r   r   model_selectionr   utilsr   r   r   utils._metadata_requestsr   r   r   r   utils._param_validationr   r   r   r   utils.extmathr   utils.metadata_routingr   r   utils.parallelr   r   utils.validationr    r!   r"   r#   r$   r%   r&    r(   r   _baser)   r*   r+   r@   rh   r{   ry   r   r  r)  r+  r  r  r  r  r  r  r  rA   r?   <module>r     s    
  #  "  #  * A A & 4 4  T S + /   " : :(d XBv O,O,q$y9:h4?@&!6(+YET"+"D);#K #'* 	k#"k\ O,O,dCV<=sD;<h4?@&!6(+YET"+"D);#K!{  #'#. D$'&D$V
p!>; pny
J y
R 
K!\j$k3 jZFHnm FHR^H>= ^HJ	z% zzL#( L#^K+NM K+\z+~} z+rA   