§
    rŠtj›  ã                   óØ   — d Z ddlmZ ddlZddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZmZ  e
dd	gdg e	d
dh¦  «        gdg eeddd¬¦  «        gdœd¬¦  «        d
dddœd„¦   «         ZdS )z!Determination of parameter boundsé    )ÚRealN)ÚLabelBinarizer)ÚIntervalÚ
StrOptionsÚvalidate_params)Úsafe_sparse_dot)Úcheck_arrayÚcheck_consistent_lengthz
array-likezsparse matrixÚsquared_hingeÚlogÚbooleanÚneither)Úclosed)ÚXÚyÚlossÚfit_interceptÚintercept_scalingT)Úprefer_skip_nested_validationg      ð?)r   r   r   c          	      óR  — t          | d¬¦  «        } t          | |¦  «         t          d¬¦  «                             |¦  «        j        }t          j        t          j        t          || ¦  «        ¦  «        ¦  «        }|r„t          j	        t          j
        |¦  «        df|t          j        |¦  «        j        ¬¦  «        }t          |t          t          j        ||¦  «        ¦  «                             ¦   «         ¦  «        }|dk    rt          d¦  «        ‚|d	k    rd
|z  S d|z  S )a‰  Return the lowest bound for `C`.

    The lower bound for `C` is computed such that for `C` in `(l1_min_C, infinity)`
    the model is guaranteed not to be empty. This applies to l1 penalized
    classifiers, such as :class:`sklearn.svm.LinearSVC` with penalty='l1' and
    :class:`sklearn.linear_model.LogisticRegression` with `l1_ratio=1`.

    This value is valid if `class_weight` parameter in `fit()` is not set.

    For an example of how to use this function, see
    :ref:`sphx_glr_auto_examples_linear_model_plot_logistic_path.py`.

    Parameters
    ----------
    X : {array-like, sparse matrix} of shape (n_samples, n_features)
        Training vector, where `n_samples` is the number of samples and
        `n_features` is the number of features.

    y : array-like of shape (n_samples,)
        Target vector relative to X.

    loss : {'squared_hinge', 'log'}, default='squared_hinge'
        Specifies the loss function.
        With 'squared_hinge' it is the squared hinge loss (a.k.a. L2 loss).
        With 'log' it is the loss of logistic regression models.

    fit_intercept : bool, default=True
        Specifies if the intercept should be fitted by the model.
        It must match the fit() method parameter.

    intercept_scaling : float, default=1.0
        When fit_intercept is True, instance vector x becomes
        [x, intercept_scaling],
        i.e. a "synthetic" feature with constant value equals to
        intercept_scaling is appended to the instance vector.
        It must match the fit() method parameter.

    Returns
    -------
    l1_min_c : float
        Minimum value for C.

    Examples
    --------
    >>> from sklearn.svm import l1_min_c
    >>> from sklearn.datasets import make_classification
    >>> X, y = make_classification(n_samples=100, n_features=20, random_state=42)
    >>> print(f"{l1_min_c(X, y, loss='squared_hinge', fit_intercept=True):.4f}")
    0.0044
    Úcsc)Úaccept_sparseéÿÿÿÿ)Ú	neg_labelé   )Údtypeg        zUIll-posed l1_min_c calculation: l1 will always select zero coefficients for this datar   g      à?g       @)r	   r
   r   Úfit_transformÚTÚnpÚmaxÚabsr   ÚfullÚsizeÚarrayr   ÚdotÚ
ValueError)r   r   r   r   r   ÚYÚdenÚbiass           úQ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sklearn/svm/_bounds.pyÚl1_min_cr+      s  € õ| 	�A UÐ+Ñ+Ô+€AÝ˜A˜qÑ!Ô!Ð!å Ð$Ñ$Ô$×2Ò2°1Ñ5Ô5Ô7€Aå
Œ&•”�¨¨1Ñ-Ô-Ñ.Ô.Ñ
/Ô
/€CØð 3ÝŒwÝŒW�Q‰ZŒZ˜ˆOÐ.µb´hÐ?PÑ6QÔ6QÔ6Wð
ñ 
ô 
ˆõ �#•s�2œ6 ! T™?œ?Ñ+Ô+×/Ò/Ñ1Ô1Ñ2Ô2ˆà
ˆc‚z€zÝð5ñ
ô 
ð 	
ð ˆÒÐØ�S‰yÐà�S‰yÐó    )Ú__doc__Únumbersr   Únumpyr   Úsklearn.preprocessingr   Úsklearn.utils._param_validationr   r   r   Úsklearn.utils.extmathr   Úsklearn.utils.validationr	   r
   r+   © r,   r*   ú<module>r5      s(  ðØ 'Ð 'ð
 Ð Ð Ð Ð Ð à Ð Ð Ð à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ Ið €à˜OÐ,Øˆ^Ø�˜_¨eÐ4Ñ5Ô5Ð6Ø#˜Ø&˜h t¨Q°¸YÐGÑGÔGÐHðð ð #'ð	ñ 	ô 	ð +¸$ÐRUð Hð Hð Hð Hñ	ô 	ðHð Hð Hr,   