§
    §éUg¿_  ã                   óî   — 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   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_fittedc                   ó²   ‡ — 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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       úL/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/sklearn/dummy.pyÚ__init__zDummyClassifier.__init__�   s   € Ø ˆŒØ(ˆÔØ ˆŒˆˆó    T©Úprefer_skip_nested_validationc                 óþ  ‡‡— |                       |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.
        F©Úcast_to_ndarrayr   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   ©éÿÿÿÿ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: {}.)Ú_validate_datar!   Ú	_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¢   sv  øø€ ð( 	×Ò˜A¨uÐÑ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   )rA   Ú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   )rA   rW   )r4   r5   s     r&   rZ   z+DummyClassifier.predict.<locals>.<listcomp>0  s"   € Ð<Ð<Ð<¨a�BœH a S™MœMÐ<Ð<Ð<r(   c                 ó\   •— g | ](}‰|         ‰|                               ¦   «                  ‘Œ)S r3   ©rX   )r4   r6   rK   rI   s     €€r&   rZ   z+DummyClassifier.predict.<locals>.<listcomp>6  sB   ø€ ð ð ð àð ! œ L°¤O×$:Ò$:Ñ$<Ô$<Ô=ðð ð r(   c                 ó`   •— g | ]*}‰|         ‰|                               d ¬¦  «                 ‘Œ+S )r   ©Úaxisr]   )r4   r6   rI   Úprobas     €€r&   rZ   z+DummyClassifier.predict.<locals>.<listcomp>?  sD   ø€ ð ð ð àð ! œ E¨!¤H§O¢O¸ OÑ$;Ô$;Ô<ðð ð r(   c                 ób   •— g | ]+}‰|         ‰                      ‰|         ‰¬ ¦  «                 ‘Œ,S )©Úsize)Úrandint)r4   r6   rI   rJ   Ú	n_samplesÚrss     €€€€r&   rZ   z+DummyClassifier.predict.<locals>.<listcomp>F  sF   ø€ ð ð ð àð ˜Q”K §
¢
¨:°a¬=¸y 
Ñ IÔ IÔJðð ð r(   )r   r   r   r   rJ   rI   rK   r   rG   r9   Úpredict_probar@   rH   r   rA   ÚtilerL   ÚvstackÚTÚravel)r%   rP   r   Ú
class_probrQ   ÚretrK   rI   rJ   rf   ra   rg   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   rc   r   r   r   )r   r   r   r   rJ   rI   rK   r   rG   rL   r9   rX   rA   ÚzerosÚfloat64ÚonesÚmultinomialÚastypeÚwhereÚappend)r%   rP   rf   rg   rJ   rI   rK   r   ÚPr6   ÚindÚouts               r&   rh   zDummyClassifier.predict_probaT  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   )rA   Úlog)r4   Úps     r&   rZ   z5DummyClassifier.predict_log_proba.<locals>.<listcomp>§  s    € Ð-Ð-Ð- !•B”F˜1‘I”IÐ-Ð-Ð-r(   )rh   rG   rA   r€   )r%   rP   ra   s      r&   Úpredict_log_probaz!DummyClassifier.predict_log_proba“  sF   € ð  ×"Ò" 1Ñ%Ô%ˆØŒ?˜aÒÐÝ”6˜%‘=”=Ð à-Ð- uÐ-Ñ-Ô-Ð-r(   c                 ó   — dddddœdœS )NTzfails for the predict method)Úcheck_methods_subset_invarianceÚ%check_methods_sample_order_invariance)Ú
poor_scoreÚno_validationÚ_xfail_checksr3   ©r%   s    r&   Ú
_more_tagszDummyClassifier._more_tags©  s'   € àØ!à3QØ9Wðð ð
ð 
ð 	
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   ©rF   ©rA   rt   ÚlenÚsuperÚscore©r%   rP   rQ   rR   Ú	__class__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
   rT   ro   rh   r‚   rŠ   r�   Ú__classcell__©r’   s   @r&   r   r   #   s/  ø€ € € € € € ð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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        rs   Ú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‰¬¦  «        | _        �nL| j        dk    rF‰€t          j        ‰d¬¦  «        | _        �n"ˆˆfd„t          | j        ¦  «        D ¦   «         | _        nû| j        dk    rg| j        €t          d¦  «        ‚| j        dz  Š‰€t          j        ‰d‰¬¦  «        | _        n±ˆˆˆfd„t          | j        ¦  «        D ¦   «         | _        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 random 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.
        Fr,   rQ   )Ú	ensure_2dÚ
input_namer   zy must not be empty.r   r.   Nrž   )r`   ÚweightsrŸ   r_   c                 óH   •— g | ]}t          ‰d d …|f         ‰d¬¦  «        ‘ŒS )Ng      I@©Ú
percentiler   )r4   r6   rR   rQ   s     €€r&   rZ   z&DummyRegressor.fit.<locals>.<listcomp>L  sD   ø€ ð "ð "ð "àõ )¨¨1¨1¨1¨a¨4¬°-ÈDÐQÑQÔQð"ð "ð "r(   r    z^When using `strategy='quantile', you have to specify the desired quantile in the range [0, 1].g      Y@)r`   Úqc                 óH   •— g | ]}t          ‰d d …|f         ‰‰¬¦  «        ‘ŒS )Nr«   r   )r4   r6   r¬   rR   rQ   s     €€€r&   rZ   z&DummyRegressor.fit.<locals>.<listcomp>[  sD   ø€ ð "ð "ð "àõ )¨¨1¨1¨1¨a¨4¬°-ÈJÐWÑWÔWð"ð "ð "r(   r   r0   )ÚcsrÚcscÚcoo)Úaccept_sparser§   Úensure_min_samplesr1   )r   r/   )r8   r   rŽ   rH   rD   rA   rE   rF   rG   r   r   r!   ÚaverageÚ	constant_rŸ   rL   r    r¬   r   Ú	TypeError)r%   rP   rQ   rR   r¬   s     ``@r&   rT   zDummyRegressor.fit"  s‹  øøø€ ð( 	×Ò˜A¨uÐÑ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�”‘ð"ð "ð "ð "ð "å" 4¤?Ñ3Ô3ð"ñ "ô "�”�ð
 Œ]˜jÒ(Ð(ØŒ}Ð$Ý ð4ñô ð ð œ¨Ñ.ˆJØÐ$Ý!#¤¨q°q¸JÐ!GÑ!GÔ!G�”�ð"ð "ð "ð "ð "ð "å" 4¤?Ñ3Ô3ð"ñ "ô "�”�ð
 Œ]˜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.
        rq   r   )
r   r   rA   ÚfullrG   rµ   rW   rr   rt   rl   )r%   rP   Ú
return_stdrf   rQ   Úy_stds         r&   ro   zDummyRegressor.predictv  s¦   € õ, 	˜ÑÔÐÝ  ‘O”Oˆ	åŒGØ˜œÐ(ØŒNÝ”(˜4œ>Ñ*Ô*Ô0ð
ñ 
ô 
ˆõ
 ”˜) T¤_Ð5Ñ6Ô6ˆàŒ?˜aÒÐÝ”˜‘”ˆAÝ”H˜U‘O”OˆEà'Ð.��5ˆzˆz¨QÐ.r(   c                 ó   — dddœS )NT)r†   r‡   r3   r‰   s    r&   rŠ   zDummyRegressor._more_tagsœ  s   € Ø"°TÐ:Ð:Ð: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
   rT   ro   rŠ   r�   rš   r›   s   @r&   r�   r�   Ñ  s6  ø€ € € € € € ð?ð ?ð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ðQð Qð Qñ 6Ô5ðQðf$/ð $/ð $/ð $/ðL;ð ;ð ;ð2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2r(   r�   )#r–   r=   Únumbersr   r   ÚnumpyrA   Úscipy.sparseÚsparser:   Úbaser   r   r   r	   r
   Úutilsr   Úutils._param_validationr   r   Úutils.multiclassr   Úutils.randomr   Úutils.statsr   Úutils.validationr   r   r   r   r   r   r�   r3   r(   r&   ú<module>rÈ      sµ  ðØ <Ð <ð €€€Ø "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð &Ð %Ð %Ð %Ð %Ð %Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø -Ð -Ð -Ð -Ð -Ð -ðð ð ð ð ð ð ð ð ð ð ð ð ð ðk2ð k2ð k2ð k2ð k2Ð&¨¸ñ k2ô k2ð k2ð\m2ð m2ð m2ð m2ð m2Ð% ~°}ñ m2ô m2ð m2ð m2ð m2r(   