
    -i(                         S SK r S SKJr  S SK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  SS	KJrJr  SS
KJrJr  SSKJrJr  SSKJr   " S S\\\
5      rg)    N)Real)sparse)linprog   )BaseEstimatorRegressorMixin_fit_context)ConvergenceWarning)_safe_indexing)Interval
StrOptions)parse_version
sp_version)_check_sample_weightvalidate_data   )LinearModelc                      ^  \ rS rSr% Sr\" \SSSS9/\" \SSSS9/S	/\" 1 S
k5      /\S/S.r	\\
S'   SSSSSS.S jr\" SS9SS j5       rU 4S jrSrU =r$ )QuantileRegressor   a
  Linear regression model that predicts conditional quantiles.

The linear :class:`QuantileRegressor` optimizes the pinball loss for a
desired `quantile` and is robust to outliers.

This model uses an L1 regularization like
:class:`~sklearn.linear_model.Lasso`.

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

.. versionadded:: 1.0

Parameters
----------
quantile : float, default=0.5
    The quantile that the model tries to predict. It must be strictly
    between 0 and 1. If 0.5 (default), the model predicts the 50%
    quantile, i.e. the median.

alpha : float, default=1.0
    Regularization constant that multiplies the L1 penalty term.

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

solver : {'highs-ds', 'highs-ipm', 'highs', 'interior-point',             'revised simplex'}, default='highs'
    Method used by :func:`scipy.optimize.linprog` to solve the linear
    programming formulation.

    It is recommended to use the highs methods because
    they are the fastest ones. Solvers "highs-ds", "highs-ipm" and "highs"
    support sparse input data and, in fact, always convert to sparse csc.

    From `scipy>=1.11.0`, "interior-point" is not available anymore.

    .. versionchanged:: 1.4
       The default of `solver` changed to `"highs"` in version 1.4.

solver_options : dict, default=None
    Additional parameters passed to :func:`scipy.optimize.linprog` as
    options. If `None` and if `solver='interior-point'`, then
    `{"lstsq": True}` is passed to :func:`scipy.optimize.linprog` for the
    sake of stability.

Attributes
----------
coef_ : array of shape (n_features,)
    Estimated coefficients for the features.

intercept_ : float
    The intercept of the model, aka bias term.

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

n_iter_ : int
    The actual number of iterations performed by the solver.

See Also
--------
Lasso : The Lasso is a linear model that estimates sparse coefficients
    with l1 regularization.
HuberRegressor : Linear regression model that is robust to outliers.

Examples
--------
>>> from sklearn.linear_model import QuantileRegressor
>>> import numpy as np
>>> n_samples, n_features = 10, 2
>>> rng = np.random.RandomState(0)
>>> y = rng.randn(n_samples)
>>> X = rng.randn(n_samples, n_features)
>>> # the two following lines are optional in practice
>>> from sklearn.utils.fixes import sp_version, parse_version
>>> reg = QuantileRegressor(quantile=0.8).fit(X, y)
>>> np.mean(y <= reg.predict(X))
np.float64(0.8)
r   r   neither)closedNleftboolean>   highshighs-ds	highs-ipminterior-pointrevised simplexquantilealphafit_interceptsolversolver_options_parameter_constraintsg      ?g      ?Tr   c                @    Xl         X l        X0l        X@l        XPl        g Nr    )selfr!   r"   r#   r$   r%   s         Q/var/www/html/venv/lib/python3.13/site-packages/sklearn/linear_model/_quantile.py__init__QuantileRegressor.__init__   s     !
*,    )prefer_skip_nested_validationc           	         [        U UU/ SQSSS9u  p[        X15      nUR                  S   nUnU R                  (       a  US-  n[        R
                  " U5      U R                  -  nU R                  S:X  a,  [        [        S5      :  a  [        SU R                   S	35      e[        R                  " U5      (       a)  U R                  S
;  a  [        SU R                   S35      eU R                  c  U R                  S:X  a  SS0nOU R                  n[        R                  " U5      S   n[        U5      n	U	[        U5      :  a  X8   n[!        X5      n[!        X(5      n[        R"                  " [        R$                  " SU-  US9X0R&                  -  USU R&                  -
  -  /5      n
U R                  (       a	  SU
S'   SX'   U R                  S
;   a  [        R(                  " XR*                  SS9nU R                  (       aR  [        R,                  " [        R.                  " U	S4UR*                  S95      n[        R0                  " XU* U* X* /SS9nO[        R0                  " X* X* /SS9nOu[        R(                  " U	5      nU R                  (       a5  [        R.                  " U	S45      n[        R"                  " XU* U* X* /SS9nO[        R"                  " X* X* /SS9nUn[3        U
UUU R                  US9nUR4                  nUR6                  (       d`  SSSSS.n[8        R:                  " SUR<                   S3UR?                  UR<                  S5      -   S-   S -   UR@                  -   [B        5        USU UUSU-   -
  nURD                  U l#        U R                  (       a  USS U l$        US   U l%        U $ UU l$        S!U l%        U $ )"a]  Fit the model according to the given training data.

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

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

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

Returns
-------
self : object
    Returns self.
)csccsrcooTF)accept_sparse	y_numericmulti_outputr   r   z1.11.0zSolver z- is not anymore available in SciPy >= 1.11.0.)r   r   r   z; does not support sparse X. Use solver 'highs' for example.Nlstsqr   r   )
fill_valuer0   )dtypeformat)shaper8   )r9   )axis)cA_eqb_eqmethodoptionszIteration limit reached.z!Problem appears to be infeasible.z Problem appears to be unbounded.z#Numerical difficulties encountered.)r   r         zDLinear programming for QuantileRegressor did not succeed.
Status is z: zunknown reason
zResult message of linprog:
g        )&r   r   r:   r#   npsumr"   r$   r   r   
ValueErrorr   issparser%   nonzerolenr   concatenatefullr!   eyer8   
csc_matrixoneshstackr   xsuccesswarningswarnstatus
setdefaultmessager
   nitn_iter_coef_
intercept_)r)   Xysample_weight
n_featuresn_paramsr"   r%   indices	n_indicesr<   rL   rN   r=   r>   resultsolutionfailureparamss                      r*   fitQuantileRegressor.fit   s   ( /
 -]>WWQZ
MH }%

2;;**z]8=T/T$++&ST  ??1$++5W"W$++ '2 2 
 &4;;:J+J%t_N!00N, **]+A.L	s=)))2Mq*Aq*ANNH7-T]]!23
 AaDAK;;<<
 **YggeDC!!((	1~QWW)UV}}duqb#t%DUS}}aS$%7F&&#C!!ww	1~.~~tr3&EAN~~q"c4&8qA;;"
 88~~-658	G MM#]]O2/$$V]]4DEF  1	1
 ..! # )8$x1x<'HHzzDJ$QiDO   DJ!DOr-   c                 F   > [         TU ]  5       nSUR                  l        U$ )NT)super__sklearn_tags__
input_tagsr   )r)   tags	__class__s     r*   rj   "QuantileRegressor.__sklearn_tags__*  s!    w')!%r-   )r"   rY   r#   rZ   rX   r!   r$   r%   r(   )__name__
__module____qualname____firstlineno____doc__r   r   r   dictr&   __annotations__r+   r	   rf   rj   __static_attributes____classcell__)rm   s   @r*   r   r      s    Vr dAq;<4D89#

  ,$D * - 5Y 6Yv r-   r   )rR   numbersr   numpyrD   scipyr   scipy.optimizer   baser   r   r	   
exceptionsr
   utilsr   utils._param_validationr   r   utils.fixesr   r   utils.validationr   r   _baser   r    r-   r*   <module>r      s@        " > > + " : 3 B Y^] Yr-   