ó
    §ñ:i54  ã                   óÜ   • S SK rSSKJrJr  SSKJr  SSKJr  SSK	J
r
JrJrJrJr   " S S	5      r " S
 S5      r " S S\\5      r\" S/ SS9\l         " S S\5      rS r " S S\5      rg)é    Né   )ÚBaseEstimatorÚClassifierMixin)ÚRequestMethodé   )Úavailable_if)Ú_check_sample_weightÚ_num_samplesÚcheck_arrayÚcheck_is_fittedÚcheck_random_statec                   ó$   • \ rS rSrSrS rS rSrg)ÚArraySlicingWrapperé   ú
Parameters
----------
array
c                 ó   • Xl         g ©N©Úarray©Úselfr   s     ÚY/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/sklearn/utils/_mocking.pyÚ__init__ÚArraySlicingWrapper.__init__   s   € Ø�
ó    c                 ó2   • [        U R                  U   5      $ r   ©ÚMockDataFramer   )r   Úaslices     r   Ú__getitem__ÚArraySlicingWrapper.__getitem__   s   € Ü˜TŸZ™Z¨Ñ/Ó0Ð0r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r    Ú__static_attributes__© r   r   r   r      s   † ñòõ1r   r   c                   óD   • \ rS rSrSrS rS rSS jrS rS r	SS	 jr
S
rg)r   é   r   c                 ó€   • Xl         Xl        UR                  U l        UR                  U l        [	        U5      U l        g r   )r   ÚvaluesÚshapeÚndimr   Úilocr   s     r   r   ÚMockDataFrame.__init__&   s.   € ØŒ
ØŒØ—[‘[ˆŒ
Ø—J‘JˆŒ	ä'¨Ó.ˆ�	r   c                 ó,   • [        U R                  5      $ r   )Úlenr   ©r   s    r   Ú__len__ÚMockDataFrame.__len__.   s   € Ü�4—:‘:‹Ðr   Nc                 ó   • U R                   $ r   r   )r   Údtypes     r   Ú	__array__ÚMockDataFrame.__array__1   s   € ð �z‰zÐr   c                 óF   • [        U R                  UR                  :H  5      $ r   r   ©r   Úothers     r   Ú__eq__ÚMockDataFrame.__eq__7   s   € Ü˜TŸZ™Z¨5¯;©;Ñ6Ó7Ð7r   c                 ó   • X:X  + $ r   r(   r;   s     r   Ú__ne__ÚMockDataFrame.__ne__:   s   € ØÒ Ð r   c                 óF   • [        U R                  R                  XS95      $ )N©Úaxis)r   r   Útake)r   ÚindicesrD   s      r   rE   ÚMockDataFrame.take=   s   € Ü˜TŸZ™ZŸ_™_¨W˜_Ð@ÓAÐAr   )r   r/   r.   r-   r,   r   )r   )r"   r#   r$   r%   r&   r   r4   r8   r=   r@   rE   r'   r(   r   r   r   r      s&   † ñò/òôò8ò!÷Br   r   c            
       ól   • \ rS rSrSrSSSSSSSSSS.	S jrSS jrSS	 jrS
 rS r	S r
SS jrS rSrg)ÚCheckingClassifieréA   ad  Dummy classifier to test pipelining and meta-estimators.

Checks some property of `X` and `y`in fit / predict.
This allows testing whether pipelines / cross-validation or metaestimators
changed the input.

Can also be used to check if `fit_params` are passed correctly, and
to force a certain score to be returned.

Parameters
----------
check_y, check_X : callable, default=None
    The callable used to validate `X` and `y`. These callable should return
    a bool where `False` will trigger an `AssertionError`. If `None`, the
    data is not validated. Default is `None`.

check_y_params, check_X_params : dict, default=None
    The optional parameters to pass to `check_X` and `check_y`. If `None`,
    then no parameters are passed in.

methods_to_check : "all" or list of str, default="all"
    The methods in which the checks should be applied. By default,
    all checks will be done on all methods (`fit`, `predict`,
    `predict_proba`, `decision_function` and `score`).

foo_param : int, default=0
    A `foo` param. When `foo > 1`, the output of :meth:`score` will be 1
    otherwise it is 0.

expected_sample_weight : bool, default=False
    Whether to check if a valid `sample_weight` was passed to `fit`.

expected_fit_params : list of str, default=None
    A list of the expected parameters given when calling `fit`.

Attributes
----------
classes_ : int
    The classes seen during `fit`.

n_features_in_ : int
    The number of features seen during `fit`.

Examples
--------
>>> from sklearn.utils._mocking import CheckingClassifier

This helper allow to assert to specificities regarding `X` or `y`. In this
case we expect `check_X` or `check_y` to return a boolean.

>>> from sklearn.datasets import load_iris
>>> X, y = load_iris(return_X_y=True)
>>> clf = CheckingClassifier(check_X=lambda x: x.shape == (150, 4))
>>> clf.fit(X, y)
CheckingClassifier(...)

We can also provide a check which might raise an error. In this case, we
expect `check_X` to return `X` and `check_y` to return `y`.

>>> from sklearn.utils import check_array
>>> clf = CheckingClassifier(check_X=check_array)
>>> clf.fit(X, y)
CheckingClassifier(...)
NÚallr   ©	Úcheck_yÚcheck_y_paramsÚcheck_XÚcheck_X_paramsÚmethods_to_checkÚ	foo_paramÚexpected_sample_weightÚexpected_fit_paramsÚrandom_statec       	         óp   • Xl         X l        X0l        X@l        XPl        X`l        Xpl        X€l        X�l        g r   rL   )
r   rM   rN   rO   rP   rQ   rR   rS   rT   rU   s
             r   r   ÚCheckingClassifier.__init__ƒ   s7   € ð ŒØ,ÔØŒØ,ÔØ 0ÔØ"ŒØ&<Ô#Ø#6Ô Ø(Õr   c                 óè  • U(       a  [        U 5        U R                  b_  U R                  c  0 OU R                  nU R                  " U40 UD6n[        U[        [
        R                  45      (       a
  U(       d   eOUnUbo  U R                  bb  U R                  c  0 OU R                  nU R                  " U40 UD6n[        U[        [
        R                  45      (       a  U(       d   e X4$ UnX4$ )aü  Validate X and y and make extra check.

Parameters
----------
X : array-like of shape (n_samples, n_features)
    The data set.
    `X` is checked only if `check_X` is not `None` (default is None).
y : array-like of shape (n_samples), default=None
    The corresponding target, by default `None`.
    `y` is checked only if `check_y` is not `None` (default is None).
should_be_fitted : bool, default=True
    Whether or not the classifier should be already fitted.
    By default True.

Returns
-------
X, y
)	r   rO   rP   Ú
isinstanceÚboolÚnpÚbool_rM   rN   )r   ÚXÚyÚshould_be_fittedÚparamsÚ	checked_XÚ	checked_ys          r   Ú
_check_X_yÚCheckingClassifier._check_X_yš   sÕ   € ö& Ü˜DÔ!Ø�<‰<Ñ#Ø×.Ñ.Ñ6‘R¸D×<OÑ<OˆFØŸš QÑ1¨&Ñ1ˆIÜ˜)¤d¬B¯H©HÐ%5×6Ñ6Þ Ð ‘yà�Ø‰=˜TŸ\™\Ñ5Ø×.Ñ.Ñ6‘R¸D×<OÑ<OˆFØŸš QÑ1¨&Ñ1ˆIÜ˜)¤d¬B¯H©HÐ%5×6Ñ6Þ Ð ‘yð ˆtˆð �Øˆtˆr   c                 óÈ  • [        U5      [        U5      :X  d   eU R                  S:X  d  SU R                  ;   a  U R                  XSS9u  p[        R                  " U5      S   U l        [        R                  " [        USSS95      U l        U R                  (       a˜  [        U R                  5      [        U5      -
  nU(       a  [        S[        U5       S	35      eUR                  5        HD  u  pg[        U5      [        U5      :w  d  M  [        S
U S[        U5       S[        U5       S35      e   U R                  (       a  Uc  [        S5      e[        X15        U $ )a€  Fit classifier.

Parameters
----------
X : array-like 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, n_outputs) or (n_samples,),                 default=None
    Target relative to X for classification or regression;
    None for unsupervised learning.

sample_weight : array-like of shape (n_samples,), default=None
    Sample weights. If None, then samples are equally weighted.

**fit_params : dict of string -> object
    Parameters passed to the ``fit`` method of the estimator

Returns
-------
self
rK   ÚfitF)r_   r   T)Ú	ensure_2dÚallow_ndzExpected fit parameter(s) z
 not seen.zFit parameter z has length z; expected Ú.z#Expected sample_weight to be passed)r
   rQ   rc   r[   r-   Ún_features_in_Úuniquer   Úclasses_rT   ÚsetÚAssertionErrorÚlistÚitemsrS   r	   )r   r]   r^   Úsample_weightÚ
fit_paramsÚmissingÚkeyÚvalues           r   rf   ÚCheckingClassifier.fit¿   s=  € ô0 ˜A‹¤,¨q£/Ó1Ð1Ð1Ø× Ñ  EÓ)¨U°d×6KÑ6KÓ-KØ—?‘? 1¸%�?Ð@‰DˆAÜ Ÿhšh q›k¨!™nˆÔÜŸ	š	¤+¨a¸5È4Ñ"PÓQˆŒØ×#×#Ü˜$×2Ñ2Ó3´c¸*³oÑEˆGÞÜ$Ø0´°g³°¸zÐJóð ð )×.Ñ.Ö0‘
�Ü Ó&¬,°q«/Õ9Ü(Ø(¨¨¨\¼,ÀuÓ:MÐ9NØ%¤l°1£oÐ%6°að9óð ñ 1ð ×&×&ØÑ$Ü$Ð%JÓKÐKÜ  Ô2àˆr   c                 óØ   • U R                   S:X  d  SU R                   ;   a  U R                  U5      u  p[        U R                  5      nUR	                  U R
                  [        U5      S9$ )zöPredict the first class seen in `classes_`.

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

Returns
-------
preds : ndarray of shape (n_samples,)
    Predictions of the first class seens in `classes_`.
rK   Úpredict)Úsize)rQ   rc   r   rU   Úchoicerl   r
   ©r   r]   r^   Úrngs       r   rx   ÚCheckingClassifier.predictï   sZ   € ð × Ñ  EÓ)¨Y¸$×:OÑ:OÓ-OØ—?‘? 1Ó%‰DˆAÜ  ×!2Ñ!2Ó3ˆØ�z‰z˜$Ÿ-™-¬l¸1«oˆzÐ>Ð>r   c                 ót  • U R                   S:X  d  SU R                   ;   a  U R                  U5      u  p[        U R                  5      nUR	                  [        U5      [        U R                  5      5      n[        R                  " XDS9nU[        R                  " USS9SS2[        R                  4   -  nU$ )ab  Predict probabilities for each class.

Here, the dummy classifier will provide a probability of 1 for the
first class of `classes_` and 0 otherwise.

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

Returns
-------
proba : ndarray of shape (n_samples, n_classes)
    The probabilities for each sample and class.
rK   Úpredict_proba)Úoutr   rC   N)rQ   rc   r   rU   Úrandnr
   r2   rl   r[   ÚabsÚsumÚnewaxis)r   r]   r^   r|   Úprobas        r   r   Ú CheckingClassifier.predict_proba  s‘   € ð  × Ñ  EÓ)¨_À×@UÑ@UÓ-UØ—?‘? 1Ó%‰DˆAÜ  ×!2Ñ!2Ó3ˆØ—	‘	œ, q›/¬3¨t¯}©}Ó+=Ó>ˆÜ—’�uÑ(ˆØ”—’˜ AÑ&¢q¬"¯*©* }Ñ5Ñ5ˆØˆr   c                 óT  • U R                   S:X  d  SU R                   ;   a  U R                  U5      u  p[        U R                  5      n[	        U R
                  5      S:X  a  UR                  [        U5      5      $ UR                  [        U5      [	        U R
                  5      5      $ )zúConfidence score.

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

Returns
-------
decision : ndarray of shape (n_samples,) if n_classes == 2                else (n_samples, n_classes)
    Confidence score.
rK   Údecision_functionr   )rQ   rc   r   rU   r2   rl   r�   r
   r{   s       r   rˆ   Ú$CheckingClassifier.decision_function  s„   € ð ×!Ñ! UÓ*Ø" d×&;Ñ&;Ó;à—?‘? 1Ó%‰DˆAÜ  ×!2Ñ!2Ó3ˆÜˆt�}‰}Ó Ó"ð —9‘9œ\¨!›_Ó-Ð-à—9‘9œ\¨!›_¬c°$·-±-Ó.@ÓAÐAr   c                 ó”   • U R                   S:X  d  SU R                   ;   a  U R                  X5        U R                  S:”  a  SnU$ SnU$ )aá  Fake score.

Parameters
----------
X : array-like of shape (n_samples, n_features)
    Input data, where `n_samples` is the number of samples and
    `n_features` is the number of features.

Y : array-like of shape (n_samples, n_output) or (n_samples,)
    Target relative to X for classification or regression;
    None for unsupervised learning.

Returns
-------
score : float
    Either 0 or 1 depending of `foo_param` (i.e. `foo_param > 1 =>
    score=1` otherwise `score=0`).
rK   Úscorer   g      ð?g        )rQ   rc   rR   )r   r]   ÚYr‹   s       r   r‹   ÚCheckingClassifier.score4  sO   € ð& × Ñ  EÓ)¨W¸×8MÑ8MÓ-MØ�O‰O˜AÔ!Ø�>‰>˜AÓØˆEð ˆð ˆEØˆr   c                 ó   • SS/S.$ )NTÚ1dlabel)Ú
_skip_testÚX_typesr(   r3   s    r   Ú
_more_tagsÚCheckingClassifier._more_tagsO  s   € Ø"°	¨{Ñ;Ð;r   )rO   rP   rM   rN   rl   rT   rS   rR   rQ   rj   rU   )NTr   )NN)r"   r#   r$   r%   r&   r   rc   rf   rx   r   rˆ   r‹   r’   r'   r(   r   r   rI   rI   A   sP   † ñ?ðH ØØØØØØ#Ø Øõ)ô.#ôJ.ò`?ò$ò0Bô6õ6<r   rI   rf   F)ÚnameÚkeysÚvalidate_keysc                   ó:   • \ rS rSrSrS
S jrS rS rS rS r	S	r
g)ÚNoSampleWeightWrapperi[  z†Wrap estimator which will not expose `sample_weight`.

Parameters
----------
est : estimator, default=None
    The estimator to wrap.
Nc                 ó   • Xl         g r   ©Úest)r   r›   s     r   r   ÚNoSampleWeightWrapper.__init__d  s   € Ø�r   c                 ó8   • U R                   R                  X5      $ r   )r›   rf   ©r   r]   r^   s      r   rf   ÚNoSampleWeightWrapper.fitg  s   € Ø�x‰x�|‰|˜AÓ!Ð!r   c                 ó8   • U R                   R                  U5      $ r   )r›   rx   ©r   r]   s     r   rx   ÚNoSampleWeightWrapper.predictj  s   € Ø�x‰x×Ñ Ó"Ð"r   c                 ó8   • U R                   R                  U5      $ r   )r›   r   r¡   s     r   r   Ú#NoSampleWeightWrapper.predict_probam  s   € Ø�x‰x×%Ñ% aÓ(Ð(r   c                 ó
   • SS0$ )Nr�   Tr(   r3   s    r   r’   Ú NoSampleWeightWrapper._more_tagsp  s   € Ø˜dÐ#Ð#r   rš   r   )r"   r#   r$   r%   r&   r   rf   rx   r   r’   r'   r(   r   r   r˜   r˜   [  s    † ñôò"ò#ò)õ$r   r˜   c                 ó   ^ • U 4S jnU$ )Nc                 óL   >• U R                   S L=(       a    TU R                   ;   $ r   ©Úresponse_methods)r   Úmethods    €r   ÚcheckÚ_check_response.<locals>.checku  s$   ø€ Ø×$Ñ$¨DÐ0×T°V¸t×?TÑ?TÑ5TÐTr   r(   )r«   r¬   s   ` r   Ú_check_responser®   t  s   ø€ õUð €Lr   c                   ó    • \ rS rSrSrSS jrS r\" \" S5      5      S 5       r	\" \" S5      5      S	 5       r
\" \" S
5      5      S 5       rSrg)Ú_MockEstimatorOnOffPredictioni{  aú  Estimator for which we can turn on/off the prediction methods.

Parameters
----------
response_methods: list of             {"predict", "predict_proba", "decision_function"}, default=None
    List containing the response implemented by the estimator. When, the
    response is in the list, it will return the name of the response method
    when called. Otherwise, an `AttributeError` is raised. It allows to
    use `getattr` as any conventional estimator. By default, no response
    methods are mocked.
Nc                 ó   • Xl         g r   r©   )r   rª   s     r   r   Ú&_MockEstimatorOnOffPrediction.__init__‰  s   € Ø 0Õr   c                 ó<   • [         R                  " U5      U l        U $ r   )r[   rk   rl   rž   s      r   rf   Ú!_MockEstimatorOnOffPrediction.fitŒ  s   € ÜŸ	š	 !›ˆŒØˆr   rx   c                 ó   • g)Nrx   r(   r¡   s     r   rx   Ú%_MockEstimatorOnOffPrediction.predict�  s   € àr   r   c                 ó   • g)Nr   r(   r¡   s     r   r   Ú+_MockEstimatorOnOffPrediction.predict_proba”  s   € àr   rˆ   c                 ó   • g)Nrˆ   r(   r¡   s     r   rˆ   Ú/_MockEstimatorOnOffPrediction.decision_function˜  s   € à"r   )rl   rª   r   )r"   r#   r$   r%   r&   r   rf   r   r®   rx   r   rˆ   r'   r(   r   r   r°   r°   {  sl   † ñô1òñ ‘/ )Ó,Ó-ñó .ðñ ‘/ /Ó2Ó3ñó 4ðñ ‘/Ð"5Ó6Ó7ñ#ó 8ó#r   r°   )Únumpyr[   Úbaser   r   Úutils._metadata_requestsr   Úmetaestimatorsr   Ú
validationr	   r
   r   r   r   r   r   rI   Úset_fit_requestr˜   r®   r°   r(   r   r   Ú<module>rÁ      sw   ðÛ ç 1Ý 4Ý (÷õ ÷1ñ 1÷!Bñ !BôHO<˜¨-ô O<ñj &3Ø	�R uñ&Ð Ô "ô
$˜Mô $ò2ô# Mõ #r   