
    -iy                     h    S SK Jr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  S r " S	 S
\5      rg)    )deepcopy   )BaseEstimator)NotFittedError)get_tags)available_if)check_is_fittedc                    ^  U 4S jnU$ )zKCheck that final_estimator has `attr`.

Used together with `available_if`.
c                 2   > [        U R                  T5        gNT)getattr	estimator)selfattrs    I/var/www/html/venv/lib/python3.13/site-packages/sklearn/frozen/_frozen.pycheck_estimator_has.<locals>.check   s    %     )r   r   s   ` r   _estimator_hasr      s    
 Lr   c                   t    \ rS rSrSrS r\" \" S5      5      S 5       rS r	S r
S rS	 rS
 rSS jrS rSrg)FrozenEstimator   a  Estimator that wraps a fitted estimator to prevent re-fitting.

This meta-estimator takes an estimator and freezes it, in the sense that calling
`fit` on it has no effect. `fit_predict` and `fit_transform` are also disabled.
All other methods are delegated to the original estimator and original estimator's
attributes are accessible as well.

This is particularly useful when you have a fitted or a pre-trained model as a
transformer in a pipeline, and you'd like `pipeline.fit` to have no effect on this
step.

Parameters
----------
estimator : estimator
    The estimator which is to be kept frozen.

See Also
--------
None: No similar entry in the scikit-learn documentation.

Examples
--------
>>> from sklearn.datasets import make_classification
>>> from sklearn.frozen import FrozenEstimator
>>> from sklearn.linear_model import LogisticRegression
>>> X, y = make_classification(random_state=0)
>>> clf = LogisticRegression(random_state=0).fit(X, y)
>>> frozen_clf = FrozenEstimator(clf)
>>> frozen_clf.fit(X, y)  # No-op
FrozenEstimator(estimator=LogisticRegression(random_state=0))
>>> frozen_clf.predict(X)  # Predictions from `clf.predict`
array(...)
c                     Xl         g Nr   )r   r   s     r   __init__FrozenEstimator.__init__>   s    "r   __getitem__c                 :    U R                   R                  " U0 UD6$ )z__getitem__ is defined in :class:`~sklearn.pipeline.Pipeline` and             :class:`~sklearn.compose.ColumnTransformer`.
        )r   r   )r   argskwargss      r   r   FrozenEstimator.__getitem__A   s    
 ~~))4:6::r   c                 V    US;   a  [        U S35      e[        U R                  U5      $ )N)fit_predictfit_transformz( is not available for frozen estimators.)AttributeErrorr   r   )r   names     r   __getattr__FrozenEstimator.__getattr__H   s1     33 D6)Q!RSSt~~t,,r   c                     U $ r   r   r   s    r   __sklearn_clone__!FrozenEstimator.__sklearn_clone__O   s    r   c                 P     [        U R                  5        g! [         a     gf = f)NTF)r	   r   r   r,   s    r   __sklearn_is_fitted__%FrozenEstimator.__sklearn_is_fitted__R   s(    	DNN+ 		s    
%%c                 0    [        U R                  5        U $ )a  No-op.

As a frozen estimator, calling `fit` has no effect.

Parameters
----------
X : object
    Ignored.

y : object
    Ignored.

*args : tuple
    Additional positional arguments. Ignored, but present for API compatibility
    with `self.estimator`.

**kwargs : dict
    Additional keyword arguments. Ignored, but present for API compatibility
    with `self.estimator`.

Returns
-------
self : object
    Returns the instance itself.
)r	   r   )r   Xyr!   r"   s        r   fitFrozenEstimator.fitY   s    4 	'r   c                 ^    UR                  SS5      nUb  X l        U(       a  [        S5      eg)a  Set the parameters of this estimator.

The only valid key here is `estimator`. You cannot set the parameters of the
inner estimator.

Parameters
----------
**kwargs : dict
    Estimator parameters.

Returns
-------
self : FrozenEstimator
    This estimator.
r   NzYou cannot set parameters of the inner estimator in a frozen estimator since calling `fit` has no effect. You can use `frozenestimator.estimator.set_params` to set parameters of the inner estimator.)popr   
ValueError)r   r"   r   s      r   
set_paramsFrozenEstimator.set_paramsv   s9      JJ{D1	 &N  r   c                     SU R                   0$ )a  Get parameters for this estimator.

Returns a `{"estimator": estimator}` dict. The parameters of the inner
estimator are not included.

Parameters
----------
deep : bool, default=True
    Ignored.

Returns
-------
params : dict
    Parameter names mapped to their values.
r   r   )r   deeps     r   
get_paramsFrozenEstimator.get_params   s      T^^,,r   c                 P    [        [        U R                  5      5      nSUl        U$ r   )r   r   r   
_skip_test)r   tagss     r   __sklearn_tags__ FrozenEstimator.__sklearn_tags__   s!    01r   r   N)T)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r)   r-   r0   r5   r:   r>   rC   __static_attributes__r   r   r   r   r      sN     D# ./0; 1;-:6-$r   r   N)copyr   baser   
exceptionsr   utilsr   utils.metaestimatorsr   utils.validationr	   r   r   r   r   r   <module>rQ      s,       '  / .Km Kr   