§
    qŠtjF_  ã                   óò   — d Z ddlZddlmZmZ ddlZddlmZ	 ddl
mZmZmZmZmZ ddlmZ ddlmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZmZmZm Z m!Z!  G d„ deee¦  «        Z" G d„ deee¦  «        Z#dS )z6Dummy estimators that implement simple rules of thumb.é    N)ÚIntegralÚReal)ÚBaseEstimatorÚClassifierMixinÚMultiOutputMixinÚRegressorMixinÚ_fit_context)Úcheck_random_state)ÚIntervalÚ
StrOptions)Úclass_distribution)Ú_random_choice_csc)Ú_weighted_percentile)Ú_check_sample_weightÚ_num_samplesÚcheck_arrayÚcheck_consistent_lengthÚcheck_is_fittedÚvalidate_datac                   ó¶   ‡ — e Zd ZU dZ eh d£¦  «        gdgeeddgdœZee	d<   ddddœd	„Z
 ed
¬¦  «        dd„¦   «         Zd„ Zd„ Zd„ Zˆ fd„Zdˆ fd„	Zˆ xZS )ÚDummyClassifiera]  DummyClassifier makes predictions that ignore the input features.

    This classifier serves as a simple baseline to compare against other more
    complex classifiers.

    The specific behavior of the baseline is selected with the `strategy`
    parameter.

    All strategies make predictions that ignore the input feature values passed
    as the `X` argument to `fit` and `predict`. The predictions, however,
    typically depend on values observed in the `y` parameter passed to `fit`.

    Note that the "stratified" and "uniform" strategies lead to
    non-deterministic predictions that can be rendered deterministic by setting
    the `random_state` parameter if needed. The other strategies are naturally
    deterministic and, once fit, always return the same constant prediction
    for any value of `X`.

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

    .. versionadded:: 0.13

    Parameters
    ----------
    strategy : {"most_frequent", "prior", "stratified", "uniform",             "constant"}, default="prior"
        Strategy to use to generate predictions.

        * "most_frequent": the `predict` method always returns the most
          frequent class label in the observed `y` argument passed to `fit`.
          The `predict_proba` method returns the matching one-hot encoded
          vector.
        * "prior": the `predict` method always returns the most frequent
          class label in the observed `y` argument passed to `fit` (like
          "most_frequent"). ``predict_proba`` always returns the empirical
          class distribution of `y` also known as the empirical class prior
          distribution.
        * "stratified": the `predict_proba` method randomly samples one-hot
          vectors from a multinomial distribution parametrized by the empirical
          class prior probabilities.
          The `predict` method returns the class label which got probability
          one in the one-hot vector of `predict_proba`.
          Each sampled row of both methods is therefore independent and
          identically distributed.
        * "uniform": generates predictions uniformly at random from the list
          of unique classes observed in `y`, i.e. each class has equal
          probability.
        * "constant": always predicts a constant label that is provided by
          the user. This is useful for metrics that evaluate a non-majority
          class.

          .. versionchanged:: 0.24
             The default value of `strategy` has changed to "prior" in version
             0.24.

    random_state : int, RandomState instance or None, default=None
        Controls the randomness to generate the predictions when
        ``strategy='stratified'`` or ``strategy='uniform'``.
        Pass an int for reproducible output across multiple function calls.
        See :term:`Glossary <random_state>`.

    constant : int or str or array-like of shape (n_outputs,), default=None
        The explicit constant as predicted by the "constant" strategy. This
        parameter is useful only for the "constant" strategy.

    Attributes
    ----------
    classes_ : ndarray of shape (n_classes,) or list of such arrays
        Unique class labels observed in `y`. For multi-output classification
        problems, this attribute is a list of arrays as each output has an
        independent set of possible classes.

    n_classes_ : int or list of int
        Number of label for each output.

    class_prior_ : ndarray of shape (n_classes,) or list of such arrays
        Frequency of each class observed in `y`. For multioutput classification
        problems, this is computed independently for each output.

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

    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.

    n_outputs_ : int
        Number of outputs.

    sparse_output_ : bool
        True if the array returned from predict is to be in sparse CSC format.
        Is automatically set to True if the input `y` is passed in sparse
        format.

    See Also
    --------
    DummyRegressor : Regressor that makes predictions using simple rules.

    Examples
    --------
    >>> import numpy as np
    >>> from sklearn.dummy import DummyClassifier
    >>> X = np.array([-1, 1, 1, 1])
    >>> y = np.array([0, 1, 1, 1])
    >>> dummy_clf = DummyClassifier(strategy="most_frequent")
    >>> dummy_clf.fit(X, y)
    DummyClassifier(strategy='most_frequent')
    >>> dummy_clf.predict(X)
    array([1, 1, 1, 1])
    >>> dummy_clf.score(X, y)
    0.75
    >   ÚpriorÚuniformÚconstantÚ
stratifiedÚmost_frequentÚrandom_stateú
array-likeN©Ústrategyr   r   Ú_parameter_constraintsr   c                ó0   — || _         || _        || _        d S ©Nr   )Úselfr    r   r   s       úK/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sklearn/dummy.pyÚ__init__zDummyClassifier.__init__œ   s   € Ø ˆŒØ(ˆÔØ ˆŒˆˆó    T©Úprefer_skip_nested_validationc                 óô  ‡‡— t          | |d¬¦  «         | j        | _        | j        dk    rBt          j        |¦  «        r.|                     ¦   «         }t          j        dt          ¦  «         t          j        |¦  «        | _	        | j	        s(t          j        |¦  «        }t          j        |¦  «        }|j        dk    rt          j        |d¦  «        }|j        d         | _        t#          ||¦  «         |�t%          ||¦  «        }| j        dk    ro| j        €t)          d	¦  «        ‚t          j        t          j        | j        ¦  «        d¦  «        Š‰j        d
         | j        k    rt)          d| j        z  ¦  «        ‚t+          ||¦  «        \  | _        | _        | _        | j        dk    r…t3          | j        ¦  «        D ]pŠt5          ˆˆfd„| j        ‰         D ¦   «         ¦  «        sGd                     | j        | j        ‰                              ¦   «         ¦  «        }t)          |¦  «        ‚Œq| j        dk    r6| j        d
         | _        | j        d
         | _        | j        d
         | _        | S )aÆ  Fit the baseline classifier.

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

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

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

        Returns
        -------
        self : object
            Returns the instance itself.
        T©Úskip_check_arrayr   zªA local copy of the target data has been converted to a numpy array. Predicting on sparse target data with the uniform strategy would not save memory and would be slower.é   ©éÿÿÿÿr-   Nr   úMConstant target value has to be specified when the constant strategy is used.r   ú0Constant target value should have shape (%d, 1).c              3   ó<   •K  — | ]}‰‰         d          |k    V — ŒdS )r   N© )Ú.0Úcr   Úks     €€r%   ú	<genexpr>z&DummyClassifier.fit.<locals>.<genexpr>é   s0   øè è € ÐIÐI°1˜8 Aœ; qœ>¨QÒ.ÐIÐIÐIÐIÐIÐIr'   zrThe constant target value must be present in the training data. You provided constant={}. Possible values are: {}.)r   r    Ú	_strategyÚspÚissparseÚtoarrayÚwarningsÚwarnÚUserWarningÚsparse_output_ÚnpÚasarrayÚ
atleast_1dÚndimÚreshapeÚshapeÚ
n_outputs_r   r   r   Ú
ValueErrorr   Úclasses_Ú
n_classes_Úclass_prior_ÚrangeÚanyÚformatÚtolist)r$   ÚXÚyÚsample_weightÚerr_msgr   r6   s        @@r%   ÚfitzDummyClassifier.fit¡   sr  øø€ õ( 	�d˜A°Ð5Ñ5Ô5Ð5àœˆŒàŒ>˜YÒ&Ð&­2¬;°q©>¬>Ð&Ø—	’	‘”ˆAÝŒMð+õ
 ñô ð õ !œk¨!™nœnˆÔàÔ"ð 	!Ý”
˜1‘”ˆAÝ”˜aÑ Ô ˆAàŒ6�QŠ;ˆ;Ý”
˜1˜gÑ&Ô&ˆAàœ' !œ*ˆŒå  1Ñ%Ô%Ð%àÐ$Ý0°ÀÑBÔBˆMàŒ>˜ZÒ'Ð'ØŒ}Ð$Ý ð:ñô ð õ
 œ:¥b¤m°D´MÑ&BÔ&BÀGÑLÔL�Ø”> !Ô$¨¬Ò7Ð7Ý$ØJØœ/ñ*ñô ð õ
 ?QØˆ}ñ?
ô ?
Ñ;ˆŒ˜œ¨Ô):ð Œ>˜ZÒ'Ð'Ý˜4œ?Ñ+Ô+ð .ð .�ÝÐIÐIÐIÐIÐI¸¼ÀaÔ8HÐIÑIÔIÑIÔIð 
.ð3ç39²6Ø œM¨4¬=¸Ô+;×+BÒ+BÑ+DÔ+Dñ4ô 4ð õ % WÑ-Ô-Ð-ð
.ð Œ?˜aÒÐØ"œo¨aÔ0ˆDŒOØ œM¨!Ô,ˆDŒMØ $Ô 1°!Ô 4ˆDÔàˆr'   c                 óJ  ‡‡‡‡	‡
‡— t          | ¦  «         t          |¦  «        Š	t          | j        ¦  «        Š| j        Š| j        Š| j        Š| j        }| j        dk    r‰gŠ‰gŠ‰gŠ|g}| j	        dk    r#|  
                    |¦  «        Š
| j        dk    r‰
gŠ
| j        rpd}| j	        dv rd„ ‰D ¦   «         Šn?| j	        dk    r‰}n1| j	        dk    rt          d¦  «        ‚| j	        dk    rd	„ |D ¦   «         Št          ‰	‰|| j        ¦  «        }�n| j	        dv r7t          j        ˆˆfd
„t!          | j        ¦  «        D ¦   «         ‰	dg¦  «        }n³| j	        dk    r9t          j        ˆˆ
fd„t!          | j        ¦  «        D ¦   «         ¦  «        j        }no| j	        dk    r=ˆˆˆ	ˆfd„t!          | j        ¦  «        D ¦   «         }t          j        |¦  «        j        }n'| j	        dk    rt          j        | j        ‰	df¦  «        }| j        dk    rt          j        |¦  «        }|S )a;  Perform classification on test vectors X.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Test data.

        Returns
        -------
        y : array-like of shape (n_samples,) or (n_samples, n_outputs)
            Predicted target values for X.
        r-   r   N)r   r   c                 ó\   — g | ])}t          j        |                     ¦   «         g¦  «        ‘Œ*S r3   )r@   ÚarrayÚargmax)r4   Úcps     r%   ú
<listcomp>z+DummyClassifier.predict.<locals>.<listcomp>#  s,   € ÐKÐKÐK¸�BœH b§i¢i¡k¤k ]Ñ3Ô3ÐKÐKÐKr'   r   zCSparse target prediction is not supported with the uniform strategyr   c                 ó8   — g | ]}t          j        |g¦  «        ‘ŒS r3   )r@   rV   )r4   r5   s     r%   rY   z+DummyClassifier.predict.<locals>.<listcomp>/  s"   € Ð<Ð<Ð<¨a�BœH a S™MœMÐ<Ð<Ð<r'   c                 ó\   •— g | ](}‰|         ‰|                               ¦   «                  ‘Œ)S r3   ©rW   )r4   r6   rJ   rH   s     €€r%   rY   z+DummyClassifier.predict.<locals>.<listcomp>5  sB   ø€ ð ð ð àð ! œ L°¤O×$:Ò$:Ñ$<Ô$<Ô=ðð ð r'   c                 ó`   •— g | ]*}‰|         ‰|                               d ¬¦  «                 ‘Œ+S )r-   ©Úaxisr\   )r4   r6   rH   Úprobas     €€r%   rY   z+DummyClassifier.predict.<locals>.<listcomp>>  sD   ø€ ð ð ð àð ! œ E¨!¤H§O¢O¸ OÑ$;Ô$;Ô<ðð ð r'   c                 ób   •— g | ]+}‰|         ‰                      ‰|         ‰¬ ¦  «                 ‘Œ,S )©Úsize)Úrandint)r4   r6   rH   rI   Ú	n_samplesÚrss     €€€€r%   rY   z+DummyClassifier.predict.<locals>.<listcomp>E  sF   ø€ ð ð ð àð ˜Q”K §
¢
¨:°a¬=¸y 
Ñ IÔ IÔJðð ð r'   )r   r   r
   r   rI   rH   rJ   r   rF   r8   Úpredict_probar?   rG   r   r@   ÚtilerK   ÚvstackÚTÚravel)r$   rO   r   Ú
class_probrP   ÚretrJ   rH   rI   re   r`   rf   s         @@@@@@r%   ÚpredictzDummyClassifier.predictü   s¹  øøøøøø€ õ 	˜ÑÔÐõ ! ‘O”Oˆ	Ý Ô 1Ñ2Ô2ˆà”_ˆ
Ø”=ˆØÔ(ˆØ”=ˆØŒ?˜aÒÐà$˜ˆJØ �zˆHØ(˜>ˆLØ �zˆHàŒ>˜\Ò)Ð)Ø×&Ò& qÑ)Ô)ˆEØŒ !Ò#Ð#Ø˜�àÔð /	 ØˆJØŒ~Ð!;Ð;Ð;ØKÐK¸lÐKÑKÔK��à” <Ò/Ð/Ø)�
�
à” 9Ò,Ð,Ý ð:ñô ð ð
 ” :Ò-Ð-Ø<Ð<°8Ð<Ñ<Ô<�å" 9¨h¸
ÀDÔDUÑVÔVˆA‰AàŒ~Ð!;Ð;Ð;Ý”Gðð ð ð ð å!& t¤Ñ!7Ô!7ðñ ô ð  �Nñô ��ð ” <Ò/Ð/Ý”Iðð ð ð ð å!& t¤Ñ!7Ô!7ðñ ô ñô ô
 ð �ð ” 9Ò,Ð,ðð ð ð ð ð ð å" 4¤?Ñ3Ô3ðñ ô �õ ”I˜c‘N”NÔ$��à” :Ò-Ð-Ý”G˜DœM¨I°q¨>Ñ:Ô:�àŒ !Ò#Ð#Ý”H˜Q‘K”K�àˆr'   c                 ó,  — t          | ¦  «         t          |¦  «        }t          | j        ¦  «        }| j        }| j        }| j        }| j        }| j        dk    r|g}|g}|g}|g}g }t          | j        ¦  «        D �]ƒ}	| j
        dk    rM||	                              ¦   «         }
t          j        |||	         ft          j        ¬¦  «        }d|dd…|
f<   �n| j
        dk    r t          j        |df¦  «        ||	         z  }nè| j
        dk    r>|                     d||	         |¬¦  «        }|                     t          j        ¦  «        }nŸ| j
        d	k    r4t          j        |||	         ft          j        ¬¦  «        }|||	         z  }n`| j
        d
k    rUt          j        ||	         ||	         k    ¦  «        }
t          j        |||	         ft          j        ¬¦  «        }d|dd…|
f<   |                     |¦  «         �Œ…| j        dk    r|d         }|S )aÊ  
        Return probability estimates for the test vectors X.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Test data.

        Returns
        -------
        P : ndarray of shape (n_samples, n_classes) or list of such arrays
            Returns the probability of the sample for each class in
            the model, where classes are ordered arithmetically, for each
            output.
        r-   r   ©Údtypeç      ð?Nr   r   rb   r   r   r   )r   r   r
   r   rI   rH   rJ   r   rF   rK   r8   rW   r@   ÚzerosÚfloat64ÚonesÚmultinomialÚastypeÚwhereÚappend)r$   rO   re   rf   rI   rH   rJ   r   ÚPr6   ÚindÚouts               r%   rg   zDummyClassifier.predict_probaS  s  € õ  	˜ÑÔÐõ ! ‘O”Oˆ	Ý Ô 1Ñ2Ô2ˆà”_ˆ
Ø”=ˆØÔ(ˆØ”=ˆØŒ?˜aÒÐà$˜ˆJØ �zˆHØ(˜>ˆLØ �zˆHàˆÝ�t”Ñ'Ô'ð 	ñ 	ˆAØŒ~ Ò0Ð0Ø" 1”o×,Ò,Ñ.Ô.�Ý”h 	¨:°a¬=Ð9ÅÄÐLÑLÔL�Ø!��A�A�A�s�F‘‘Ø” 7Ò*Ð*Ý”g˜y¨!˜nÑ-Ô-°¸Q´Ñ?��à” <Ò/Ð/Ø—n’n Q¨°Q¬¸i�nÑHÔH�Ø—j’j¥¤Ñ,Ô,��à” 9Ò,Ð,Ý”g˜y¨*°Q¬-Ð8ÅÄ
ÐKÑKÔK�Ø�z !”}Ñ$��à” :Ò-Ð-Ý”h˜x¨œ{¨h°q¬kÒ9Ñ:Ô:�Ý”h 	¨:°a¬=Ð9ÅÄÐLÑLÔL�Ø!��A�A�A�s�F‘à�HŠH�S‰MŒMˆM‰MàŒ?˜aÒÐØ�!”ˆAàˆr'   c                 ó‚   — |                       |¦  «        }| j        dk    rt          j        |¦  «        S d„ |D ¦   «         S )aÚ  
        Return log probability estimates for the test vectors X.

        Parameters
        ----------
        X : {array-like, object with finite length or shape}
            Training data.

        Returns
        -------
        P : ndarray of shape (n_samples, n_classes) or list of such arrays
            Returns the log probability of the sample for each class in
            the model, where classes are ordered arithmetically for each
            output.
        r-   c                 ó6   — g | ]}t          j        |¦  «        ‘ŒS r3   )r@   Úlog)r4   Úps     r%   rY   z5DummyClassifier.predict_log_proba.<locals>.<listcomp>¦  s    € Ð-Ð-Ð- !•B”F˜1‘I”IÐ-Ð-Ð-r'   )rg   rF   r@   r   )r$   rO   r`   s      r%   Úpredict_log_probaz!DummyClassifier.predict_log_proba’  sF   € ð  ×"Ò" 1Ñ%Ô%ˆØŒ?˜aÒÐÝ”6˜%‘=”=Ð à-Ð- uÐ-Ñ-Ô-Ð-r'   c                 ó†   •— t          ¦   «                              ¦   «         }d|j        _        d|j        _        d|_        |S ©NT)ÚsuperÚ__sklearn_tags__Ú
input_tagsÚsparseÚclassifier_tagsÚ
poor_scoreÚno_validation©r$   ÚtagsÚ	__class__s     €r%   r…   z DummyClassifier.__sklearn_tags__¨  s:   ø€ Ý‰wŒw×'Ò'Ñ)Ô)ˆØ!%ˆŒÔØ*.ˆÔÔ'Ø!ˆÔØˆr'   c                 ó–   •— |€$t          j        t          |¦  «        df¬¦  «        }t          ¦   «                              |||¦  «        S )ak  Return the mean accuracy on the given test data and labels.

        In multi-label classification, this is the subset accuracy
        which is a harsh metric since you require for each sample that
        each label set be correctly predicted.

        Parameters
        ----------
        X : None or array-like of shape (n_samples, n_features)
            Test samples. Passing None as test samples gives the same result
            as passing real test samples, since DummyClassifier
            operates independently of the sampled observations.

        y : array-like of shape (n_samples,) or (n_samples, n_outputs)
            True labels for X.

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

        Returns
        -------
        score : float
            Mean accuracy of self.predict(X) w.r.t. y.
        Nr-   ©rE   ©r@   rs   Úlenr„   Úscore©r$   rO   rP   rQ   r�   s       €r%   r’   zDummyClassifier.score¯  s@   ø€ ð2 ˆ9Ý”¥ A¡¤¨˜{Ð+Ñ+Ô+ˆAÝ‰wŒw�}Š}˜Q  =Ñ1Ô1Ð1r'   r#   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr!   ÚdictÚ__annotations__r&   r	   rS   rn   rg   r�   r…   r’   Ú__classcell__©r�   s   @r%   r   r   "   s9  ø€ € € € € € ðoð oðf ˆJÐVÐVÐVÑWÔWð
ð (Ð(Ø˜s L°$Ð7ð$ð $Ð˜Dð ð ñ ð $+¸Èð !ð !ð !ð !ð !ð
 €\°Ð5Ñ5Ô5ðXð Xð Xñ 6Ô5ðXðtUð Uð Uðn=ð =ð =ð~.ð .ð .ð,ð ð ð ð ð2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2r'   r   c                   óà   ‡ — e Zd ZU dZ eh d£¦  «        g eeddd¬¦  «        dg eeddd¬¦  «        d	dgd
œZee	d<   ddddœd„Z
 ed¬¦  «        dd„¦   «         Zdd„Zˆ fd„Zdˆ fd„	Zˆ xZS )ÚDummyRegressoraŸ  Regressor that makes predictions using simple rules.

    This regressor is useful as a simple baseline to compare with other
    (real) regressors. Do not use it for real problems.

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

    .. versionadded:: 0.13

    Parameters
    ----------
    strategy : {"mean", "median", "quantile", "constant"}, default="mean"
        Strategy to use to generate predictions.

        * "mean": always predicts the mean of the training set
        * "median": always predicts the median of the training set
        * "quantile": always predicts a specified quantile of the training set,
          provided with the quantile parameter.
        * "constant": always predicts a constant value that is provided by
          the user.

    constant : int or float or array-like of shape (n_outputs,), default=None
        The explicit constant as predicted by the "constant" strategy. This
        parameter is useful only for the "constant" strategy.

    quantile : float in [0.0, 1.0], default=None
        The quantile to predict using the "quantile" strategy. A quantile of
        0.5 corresponds to the median, while 0.0 to the minimum and 1.0 to the
        maximum.

    Attributes
    ----------
    constant_ : ndarray of shape (1, n_outputs)
        Mean or median or quantile of the training targets or constant value
        given by the user.

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

    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.

    n_outputs_ : int
        Number of outputs.

    See Also
    --------
    DummyClassifier: Classifier that makes predictions using simple rules.

    Examples
    --------
    >>> import numpy as np
    >>> from sklearn.dummy import DummyRegressor
    >>> X = np.array([1.0, 2.0, 3.0, 4.0])
    >>> y = np.array([2.0, 3.0, 5.0, 10.0])
    >>> dummy_regr = DummyRegressor(strategy="mean")
    >>> dummy_regr.fit(X, y)
    DummyRegressor()
    >>> dummy_regr.predict(X)
    array([5., 5., 5., 5.])
    >>> dummy_regr.score(X, y)
    0.0
    >   ÚmeanÚmedianr   Úquantileg        rr   Úboth)ÚclosedNÚneitherr   )r    r¡   r   r!   rŸ   ©r    r   r¡   c                ó0   — || _         || _        || _        d S r#   r¥   )r$   r    r   r¡   s       r%   r&   zDummyRegressor.__init__  s   € Ø ˆŒØ ˆŒØ ˆŒˆˆr'   Tr(   c                 ó&  — t          | |d¬¦  «         t          |dd¬¦  «        }t          |¦  «        dk    rt          d¦  «        ‚|j        dk    rt          j        |d	¦  «        }|j        d         | _        t          |||¦  «         |�t          ||¦  «        }| j        dk    rt          j        |d|¬¦  «        | _        �n-| j        dk    r7|€t          j        |d¬¦  «        | _        �nt          ||d¬¦  «        | _        në| j        dk    rW| j        €t          d¦  «        ‚| j        dz  }|€t          j        |d|¬¦  «        | _        n¡t          |||¬¦  «        | _        n‰| j        dk    r~| j        €t'          d¦  «        ‚t          | j        g d¢dd¬¦  «        | _        | j        dk    r>| j        j        d         |j        d         k    rt          d|j        d         z  ¦  «        ‚t          j        | j        d¦  «        | _        | S )aº  Fit the baseline regressor.

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

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

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

        Returns
        -------
        self : object
            Fitted estimator.
        Tr+   FrP   )Ú	ensure_2dÚ
input_namer   zy must not be empty.r-   r.   NrŸ   )r_   Úweightsr    r^   g      I@)Úpercentile_rankr¡   z^When using `strategy='quantile', you have to specify the desired quantile in the range [0, 1].g      Y@)r_   Úqr   r0   )ÚcsrÚcscÚcoo)Úaccept_sparser¨   Úensure_min_samplesr1   )r-   r/   )r   r   r‘   rG   rC   r@   rD   rE   rF   r   r   r    ÚaverageÚ	constant_r    r   r¡   Ú
percentiler   Ú	TypeError)r$   rO   rP   rQ   r«   s        r%   rS   zDummyRegressor.fit  sG  € õ( 	�d˜A°Ð5Ñ5Ô5Ð5å˜ U°sÐ;Ñ;Ô;ˆÝˆq‰6Œ6�QŠ;ˆ;ÝÐ3Ñ4Ô4Ð4àŒ6�QŠ;ˆ;Ý”
˜1˜gÑ&Ô&ˆAØœ' !œ*ˆŒå  1 mÑ4Ô4Ð4àÐ$Ý0°ÀÑBÔBˆMàŒ=˜FÒ"Ð"ÝœZ¨°¸=ÐIÑIÔIˆDŒN‰NàŒ]˜hÒ&Ð&ØÐ$Ý!#¤¨1°1Ð!5Ñ!5Ô!5�”‘å!5Ø�}°dð"ñ "ô "�”�ð Œ]˜jÒ(Ð(ØŒ}Ð$Ý ð4ñô ð ð #œm¨eÑ3ˆOØÐ$Ý!#¤¨q°q¸OÐ!LÑ!LÔ!L�”�å!5Ø�}°oð"ñ "ô "�”�ð Œ]˜jÒ(Ð(ØŒ}Ð$Ýð:ñô ð õ
 )Ø”Ø3Ð3Ð3ØØ#$ð	ñ ô ˆDŒNð Œ !Ò#Ð#¨¬Ô(<¸QÔ(?À1Ä7È1Ä:Ò(MÐ(MÝ ØFÈÌÐQRÌÑSñô ð õ œ D¤N°GÑ<Ô<ˆŒØˆr'   Fc                 óh  — t          | ¦  «         t          |¦  «        }t          j        || j        f| j        t          j        | j        ¦  «        j        ¬¦  «        }t          j        || j        f¦  «        }| j        dk    r(t          j	        |¦  «        }t          j	        |¦  «        }|r||fn|S )a’  Perform classification on test vectors X.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Test data.

        return_std : bool, default=False
            Whether to return the standard deviation of posterior prediction.
            All zeros in this case.

            .. versionadded:: 0.20

        Returns
        -------
        y : array-like of shape (n_samples,) or (n_samples, n_outputs)
            Predicted target values for X.

        y_std : array-like of shape (n_samples,) or (n_samples, n_outputs)
            Standard deviation of predictive distribution of query points.
        rp   r-   )
r   r   r@   ÚfullrF   r³   rV   rq   rs   rk   )r$   rO   Ú
return_stdre   rP   Úy_stds         r%   rn   zDummyRegressor.predictp  s¦   € õ, 	˜ÑÔÐÝ  ‘O”Oˆ	åŒGØ˜œÐ(ØŒNÝ”(˜4œ>Ñ*Ô*Ô0ð
ñ 
ô 
ˆõ
 ”˜) T¤_Ð5Ñ6Ô6ˆàŒ?˜aÒÐÝ”˜‘”ˆAÝ”H˜U‘O”OˆEà'Ð.��5ˆzˆz¨QÐ.r'   c                 ó†   •— t          ¦   «                              ¦   «         }d|j        _        d|j        _        d|_        |S rƒ   )r„   r…   r†   r‡   Úregressor_tagsr‰   rŠ   r‹   s     €r%   r…   zDummyRegressor.__sklearn_tags__–  s:   ø€ Ý‰wŒw×'Ò'Ñ)Ô)ˆØ!%ˆŒÔØ)-ˆÔÔ&Ø!ˆÔØˆr'   c                 ó–   •— |€$t          j        t          |¦  «        df¬¦  «        }t          ¦   «                              |||¦  «        S )aŽ  Return the coefficient of determination R^2 of the prediction.

        The coefficient R^2 is defined as `(1 - u/v)`, where `u` is the
        residual sum of squares `((y_true - y_pred) ** 2).sum()` and `v` is the
        total sum of squares `((y_true - y_true.mean()) ** 2).sum()`. The best
        possible score is 1.0 and it can be negative (because the model can be
        arbitrarily worse). A constant model that always predicts the expected
        value of y, disregarding the input features, would get a R^2 score of
        0.0.

        Parameters
        ----------
        X : None or array-like of shape (n_samples, n_features)
            Test samples. Passing None as test samples gives the same result
            as passing real test samples, since `DummyRegressor`
            operates independently of the sampled observations.

        y : array-like of shape (n_samples,) or (n_samples, n_outputs)
            True values for X.

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

        Returns
        -------
        score : float
            R^2 of `self.predict(X)` w.r.t. y.
        Nr-   r�   r�   r“   s       €r%   r’   zDummyRegressor.score�  s@   ø€ ð: ˆ9Ý”¥ A¡¤¨˜{Ð+Ñ+Ô+ˆAÝ‰wŒw�}Š}˜Q  =Ñ1Ô1Ð1r'   r#   )F)r”   r•   r–   r—   r   r   r   r!   r™   rš   r&   r	   rS   rn   r…   r’   r›   rœ   s   @r%   rž   rž   Í  s@  ø€ € € € € € ð?ð ?ðD  �ZÐ JÐ JÐ JÑKÔKÐLØ�X˜d C¨°VÐ<Ñ<Ô<¸dÐCàˆH�T˜4 ¨iÐ8Ñ8Ô8ØØð
ð$ð $Ð˜Dð ð ñ ð $*°DÀ4ð !ð !ð !ð !ð !ð
 €\°Ð5Ñ5Ô5ðOð Oð Oñ 6Ô5ðOðb$/ð $/ð $/ð $/ðLð ð ð ð ð2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2r'   rž   )$r—   r<   Únumbersr   r   Únumpyr@   Úscipy.sparser‡   r9   Úsklearn.baser   r   r   r   r	   Úsklearn.utilsr
   Úsklearn.utils._param_validationr   r   Úsklearn.utils.multiclassr   Úsklearn.utils.randomr   Úsklearn.utils.statsr   Úsklearn.utils.validationr   r   r   r   r   r   r   rž   r3   r'   r%   ú<module>rÇ      s¿  ðØ <Ð <ð
 €€€Ø "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð -Ð ,Ð ,Ð ,Ð ,Ð ,Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ðh2ð h2ð h2ð h2ð h2Ð&¨¸ñ h2ô h2ð h2ðVo2ð o2ð o2ð o2ð o2Ð% ~°}ñ o2ô o2ð o2ð o2ð o2r'   