
     h                     l   d Z ddlZddlZddlmZ ddlZddlZddlZddlZ	ddl
mZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  dddZ! G d d          Z" G d d          Z# G d d          Z$ G d d          Z% G d d           Z& G d! d"e          Z' G d# d$          Z( G d% d&          Z) G d' d(          Z* G d) d*          Z+ G d+ d,          Z, G d- d.          Z- G d/ d0          Z.d1 Z/d2 Z0d3 Z1dS )4z Base classes for all estimators.    N)defaultdict   )__version__)
get_config)	_IS_32BIT)_SetOutputMixin_DEFAULT_TAGS)	check_X_ycheck_array)_check_y)_num_features_check_feature_names_in)_generate_get_feature_names_out)check_is_fitted)_get_feature_namesestimator_html_repr)validate_parameter_constraintsTsafec                4   t          |           }|t          t          t          t          fv r |fd| D                       S t          | d          rt          | t                     rjst          j        |           S t          | t                     rt          d          t          dt          |           dt          |           d          | j        }|                     d          }|                                D ]\  }}t          |d	          ||<    |di |}|                    d          }|D ]+}||         }	||         }
|	|
urt          d
| d|          ,t          | d          rt          j        | j                  |_        |S )ar  Construct a new unfitted estimator with the same parameters.

    Clone does a deep copy of the model in an estimator
    without actually copying attached data. It returns a new estimator
    with the same parameters that has not been fitted on any data.

    Parameters
    ----------
    estimator : {list, tuple, set} of estimator instance or a single             estimator instance
        The estimator or group of estimators to be cloned.
    safe : bool, default=True
        If safe is False, clone will fall back to a deep copy on objects
        that are not estimators.

    Returns
    -------
    estimator : object
        The deep copy of the input, an estimator if input is an estimator.

    Notes
    -----
    If the estimator's `random_state` parameter is an integer (or if the
    estimator doesn't have a `random_state` parameter), an *exact clone* is
    returned: the clone and the original estimator will give the exact same
    results. Otherwise, *statistical clone* is returned: the clone might
    return different results from the original estimator. More details can be
    found in :ref:`randomness`.
    c                 2    g | ]}t          |           S )r   )clone).0er   s     H/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/sklearn/base.py
<listcomp>zclone.<locals>.<listcomp>C   s&    FFFquQT222FFF    
get_paramszaCannot clone object. You should provide an instance of scikit-learn estimator instead of a class.zCannot clone object 'z' (type zb): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' method.Fdeepr   zCannot clone object z?, as the constructor either does not set or modifies parameter _sklearn_output_config )typelisttupleset	frozensethasattr
isinstancecopydeepcopy	TypeErrorrepr	__class__r"   itemsr   RuntimeErrorr%   )	estimatorr   estimator_typeklassnew_object_paramsnameparam
new_object
params_setparam1param2s    `         r   r   r   "   s   < )__N$sI666~FFFFIFFFGGGY-- It1L1L  	=+++)T** C    i /39ooootIP   E!,,%,88(..00 ; ;e"'E":":":$++*++J&&E&22J "  "4(D!,BK))TTS     y233 
,0M,-
 -

) r!   c                        e Zd ZdZed             ZddZd ZddZ fdZ	 fd	Z
d
 Zd Zd Zd Z	 	 	 	 ddZd Zed             Zd Zd Z xZS )BaseEstimatorzBase class for all estimators in scikit-learn.

    Notes
    -----
    All estimators should specify all the parameters that can be set
    at the class level in their ``__init__`` as explicit keyword
    arguments (no ``*args`` or ``**kwargs``).
    c                 N   t          | j        d| j                  }|t          j        u rg S t          j        |          }d |j                                        D             }|D ](}|j        |j        k    rt          d| d|d          )t          d |D                       S )z%Get parameter names for the estimatordeprecated_originalc                 H    g | ]}|j         d k    |j        |j        k    | S self)r9   kindVAR_KEYWORDr   ps     r   r    z2BaseEstimator._get_param_names.<locals>.<listcomp>   s=     
 
 
vAFam$;$; $;$;$;r!   zpscikit-learn estimators should always specify their parameters in the signature of their __init__ (no varargs). z with constructor z! doesn't  follow this convention.c                     g | ]	}|j         
S r&   )r9   rH   s     r   r    z2BaseEstimator._get_param_names.<locals>.<listcomp>   s    222!qv222r!   )getattr__init__objectinspect	signature
parametersvaluesrF   VAR_POSITIONALr4   sorted)clsinitinit_signaturerP   rI   s        r   _get_param_nameszBaseEstimator._get_param_namesz   s    
 s|%:CLII6?""I !*400
 
#.5577
 
 


  	 	Av)))"l
 36##~~~	G   * 22z222333r!   Tc                 X   t                      }|                                 D ]t          |           }|rlt          |d          r\t	          |t
                    sG|                                                                }|                    fd|D                        ||<   |S )ae  
        Get parameters for this estimator.

        Parameters
        ----------
        deep : bool, default=True
            If True, will return the parameters for this estimator and
            contained subobjects that are estimators.

        Returns
        -------
        params : dict
            Parameter names mapped to their values.
        r"   c              3   2   K   | ]\  }}d z   |z   |fV  dS )__Nr&   )r   kvalkeys      r   	<genexpr>z+BaseEstimator.get_params.<locals>.<genexpr>   s4      JJVQC$JNC0JJJJJJr!   )	dictrW   rK   r,   r-   r'   r"   r3   update)rE   r$   outvalue
deep_itemsr]   s        @r   r"   zBaseEstimator.get_params   s     ff((** 	 	CD#&&E K|44 KZt=T=T K"--//5577


JJJJzJJJJJJCHH
r!   c           
         |s| S |                      d          }t          t                    }|                                D ]s\  }}|                    d          \  }}}||vr-|                                 }t          d|d|  d|d          |r|||         |<   ]t          | ||           |||<   t|                                D ]}\  }}	|dk    r_||         d	k    rS| j        	                    d
          r9t          j        d| j        j         d| j        j         dt          d           d} ||         j        di |	 ~| S )a  Set the parameters of this estimator.

        The method works on simple estimators as well as on nested objects
        (such as :class:`~sklearn.pipeline.Pipeline`). The latter have
        parameters of the form ``<component>__<parameter>`` so that it's
        possible to update each component of a nested object.

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

        Returns
        -------
        self : estimator instance
            Estimator instance.
        Tr#   rZ   zInvalid parameter z for estimator z. Valid parameters are: .base_estimator
deprecatedsklearn.zParameter 'base_estimator' of z, is deprecated in favor of 'estimator'. See z's docstring for more details.   )
stacklevelr5   r&   )r"   r   r_   r3   	partitionrW   
ValueErrorsetattr
__module__
startswithwarningswarnr2   __name__FutureWarning
set_params)
rE   paramsvalid_paramsnested_paramsr]   rb   delimsub_keylocal_valid_params
sub_paramss
             r   rt   zBaseEstimator.set_params   s   $  	KD11#D)) ,,.. 	* 	*JC"%--"5"5C,&&%)%:%:%<%<" E E Et E E-?E E E  
  *.3c"7++c5)))$)S!!,2244 	7 	7OC ''' %55O..z:: 6 PT^5L P P/P P P "     "(L(66:6666r!     c                    ddl m} d} |ddd|          }|                    |           }t          d                    |                                                    }||k    r|dz  }d|z  }t          j        ||                                          }	t          j        ||d d d	                                                   }
d
||	|
          v r5|dz  }t          j        ||d d d	                                                   }
d}|	t          |          z   t          |          |
z
  k     r|d |	         dz   ||
 d          z   }|S )Nr   )_EstimatorPrettyPrinter   T)compactindentindent_at_namen_max_elements_to_show ri   z^(\s*\S){%d}
z[^\n]*\nz...)	utils._pprintr~   pformatlenjoinsplitrematchend)rE   
N_CHAR_MAXr~   N_MAX_ELEMENTS_TO_SHOWpprepr_
n_nonblanklimregexleft_lim	right_limellipsiss               r   __repr__zBaseEstimator.__repr__   ss   
 	;:::::!# %$#9	
 
 
 

4   //00

""/C#c)E xu--1133Hddd4488::IuXyj0111 $HUE$$B$K88<<>>	H#h--'#e**y*@@@ixi(505)3EEr!   c                    t          | dd           rt          d          	 t                                                      }|| j                                        }n)# t          $ r | j                                        }Y nw xY wt          |           j        	                    d          r(t          |                                t                    S |S )N	__slots__zSYou cannot use `__slots__` in objects inheriting from `sklearn.base.BaseEstimator`.rh   )_sklearn_version)rK   r0   super__getstate____dict__r.   AttributeErrorr'   rn   ro   r_   r3   r   )rE   stater2   s     r   r   zBaseEstimator.__getstate__$  s    4d++ 	0  
	)GG((**E} **,, 	) 	) 	)M&&((EEE	) :: ++J77 	DDDDLs   ;A #BBc                    t          |           j                            d          r_|                    dd          }|t          k    r>t          j        d                    | j        j	        |t                    t                     	 t                                          |           d S # t          $ r | j                            |           Y d S w xY w)Nrh   r   zpre-0.18a  Trying to unpickle estimator {0} from version {1} when using version {2}. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations)r'   rn   ro   popr   rp   rq   formatr2   rr   UserWarningr   __setstate__r   r   r`   )rE   r   pickle_versionr2   s      r   r   zBaseEstimator.__setstate__:  s    :: ++J77 	"YY'9:FFN,,<
 =CF/= =  
 
 
	(GG  ''''' 	( 	( 	(M  ''''''	(s   	!B, ,$CCc                     t           S Nr	   rD   s    r   
_more_tagszBaseEstimator._more_tagsN  s    r!   c                     i }t          t          j        | j                            D ]<}t	          |d          r*|                    |           }|                    |           =|S )Nr   )reversedrN   getmror2   r,   r   r`   )rE   collected_tags
base_class	more_tagss       r   	_get_tagszBaseEstimator._get_tagsQ  sl    "7>$.#A#ABB 	1 	1Jz<00 1 '11$77	%%i000r!   c           	      h   	 t          |          }nP# t          $ rC}|s6t          | d          r&t          d| j        j         d| j         d          |Y d}~dS d}~ww xY w|r	|| _        dS t          | d          sdS || j        k    r(t          d| d| j        j         d| j         d          dS )	a  Set the `n_features_in_` attribute, or check against it.

        Parameters
        ----------
        X : {ndarray, sparse matrix} of shape (n_samples, n_features)
            The input samples.
        reset : bool
            If True, the `n_features_in_` attribute is set to `X.shape[1]`.
            If False and the attribute exists, then check that it is equal to
            `X.shape[1]`. If False and the attribute does *not* exist, then
            the check is skipped.
            .. note::
               It is recommended to call reset=True in `fit` and in the first
               call to `partial_fit`. All other methods that validate `X`
               should set `reset=False`.
        n_features_in_z%X does not contain any features, but z is expecting z	 featuresNzX has z features, but z features as input.)r   r0   r,   rl   r2   rr   r   )rE   Xreset
n_featuresr   s        r   _check_n_featureszBaseEstimator._check_n_features\  s9   "	&q))JJ 		 		 		 WT+;<<  6~.6 6*6 6 6  	 FFFFF		  	",DFt-.. 	 F,,,I I IDN4K I I $ 3I I I   -,s    
A8AAc                   |r;t          |          }||| _        n t          | d          rt          | d           dS t	          | dd          }t          |          }||dS |&|$t          j        d| j        j         d           dS |&|$t          j        d| j        j         d           dS t          |          t          |          k    st          j        ||k              rd}t          |          }t          |          }t          ||z
            }	t          ||z
            }
d }|	r|d	z  }| ||	          z  }|
r|d
z  }| ||
          z  }|
s|	s|dz  }t          |          dS )a  Set or check the `feature_names_in_` attribute.

        .. versionadded:: 1.0

        Parameters
        ----------
        X : {ndarray, dataframe} of shape (n_samples, n_features)
            The input samples.

        reset : bool
            Whether to reset the `feature_names_in_` attribute.
            If False, the input will be checked for consistency with
            feature names of data provided when reset was last True.
            .. note::
               It is recommended to call `reset=True` in `fit` and in the first
               call to `partial_fit`. All other methods that validate `X`
               should set `reset=False`.
        Nfeature_names_in_zX has feature names, but z! was fitted without feature namesz)X does not have valid feature names, but z was fitted with feature nameszBThe feature names should match those that were passed during fit.
c                 d    d}d}t          |           D ]\  }}||k    r|dz  } n
|d| dz  }|S )Nr      z- ...
z- r   )	enumerate)namesoutputmax_n_namesir9   s        r   	add_namesz5BaseEstimator._check_feature_names.<locals>.add_names  sZ    (// , ,GAtK'')+m4mmm+FFr!   z"Feature names unseen at fit time:
z1Feature names seen at fit time, yet now missing:
z=Feature names must be in the same order as they were in fit.
)r   r   r,   delattrrK   rp   rq   r2   rr   r   npanyr*   rS   rl   )rE   r   r   feature_names_infitted_feature_namesX_feature_namesmessagefitted_feature_names_setX_feature_names_setunexpected_namesmissing_namesr   s               r   _check_feature_namesz"BaseEstimator._check_feature_names  s1   (  	1!44+)9&&233 3 1222F&t-@$GG,Q//'O,CF&+?+GM!DN,C ! ! !   F"';'GMLN+L L L   F #$$O(<(<<< O3A
 A
< V  (++?'@'@$"%o"6"6%&9<T&TUU"#;>Q#QRRM     7@@99%5666 4OO99]333  )9 T W%%%G =<r!   no_validationFc                    |                      ||           |7|                                 d         rt          d| j        j         d          t          |t                    o|dk    }|du pt          |t                    o|dk    }d| i}i ||}|r|rt          d          |s|rt          |fd	d
i|}|}	nc|r|st          |fi |}|}	nO|r8|\  }
}d|
vri ||
}
t          |fd	d
i|
}d|vri ||}t          |fd	di|}nt          ||fi |\  }}||f}	|s-|
                    dd          r|                     ||           |	S )a}
  Validate input data and set or check the `n_features_in_` attribute.

        Parameters
        ----------
        X : {array-like, sparse matrix, dataframe} of shape                 (n_samples, n_features), default='no validation'
            The input samples.
            If `'no_validation'`, no validation is performed on `X`. This is
            useful for meta-estimator which can delegate input validation to
            their underlying estimator(s). In that case `y` must be passed and
            the only accepted `check_params` are `multi_output` and
            `y_numeric`.

        y : array-like of shape (n_samples,), default='no_validation'
            The targets.

            - If `None`, `check_array` is called on `X`. If the estimator's
              requires_y tag is True, then an error will be raised.
            - If `'no_validation'`, `check_array` is called on `X` and the
              estimator's requires_y tag is ignored. This is a default
              placeholder and is never meant to be explicitly set. In that case
              `X` must be passed.
            - Otherwise, only `y` with `_check_y` or both `X` and `y` are
              checked with either `check_array` or `check_X_y` depending on
              `validate_separately`.

        reset : bool, default=True
            Whether to reset the `n_features_in_` attribute.
            If False, the input will be checked for consistency with data
            provided when reset was last True.
            .. note::
               It is recommended to call reset=True in `fit` and in the first
               call to `partial_fit`. All other methods that validate `X`
               should set `reset=False`.

        validate_separately : False or tuple of dicts, default=False
            Only used if y is not None.
            If False, call validate_X_y(). Else, it must be a tuple of kwargs
            to be used for calling check_array() on X and y respectively.

            `estimator=self` is automatically added to these dicts to generate
            more informative error message in case of invalid input data.

        **check_params : kwargs
            Parameters passed to :func:`sklearn.utils.check_array` or
            :func:`sklearn.utils.check_X_y`. Ignored if validate_separately
            is not False.

            `estimator=self` is automatically added to these params to generate
            more informative error message in case of invalid input data.

        Returns
        -------
        out : {ndarray, sparse matrix} or tuple of these
            The validated input. A tuple is returned if both `X` and `y` are
            validated.
        )r   N
requires_yzThis z= estimator requires y to be passed, but the target y is None.r   r5   z*Validation should be done on X, y or both.
input_namer   y	ensure_2dT)r   r   rl   r2   rr   r-   strr   r   r   getr   )rE   r   r   r   validate_separatelycheck_paramsno_val_Xno_val_ydefault_check_paramsra   check_X_paramscheck_y_paramss               r   _validate_datazBaseEstimator._validate_data  s   B 	!!!5!1119)),79E/ E E E  
 a%%>!*>9K
1c 2 2 KqO7K +T2?.?,? 	 	IJJJ 	h 	A>>#>>>ACC 	h 	++l++ACC" 7
 2E.n44%O(<%O%ONDDcD^DDn44%O(<%O%ONDDcD^DD A66661Q$C 	3L,,[$?? 	3""1E"222
r!   c                 p    t          | j        |                     d          | j        j                   dS )aY  Validate types and values of constructor parameters

        The expected type and values must be defined in the `_parameter_constraints`
        class attribute, which is a dictionary `param_name: list of constraints`. See
        the docstring of `validate_parameter_constraints` for a description of the
        accepted constraints.
        Fr#   )caller_nameN)r   _parameter_constraintsr"   r2   rr   rD   s    r   _validate_paramszBaseEstimator._validate_paramsP  sD     	''OOO''/	
 	
 	
 	
 	
 	
r!   c                 ^    t                      d         dk    rt          d          | j        S )a  HTML representation of estimator.

        This is redundant with the logic of `_repr_mimebundle_`. The latter
        should be favorted in the long term, `_repr_html_` is only
        implemented for consumers who do not interpret `_repr_mimbundle_`.
        displaydiagramzW_repr_html_ is only defined when the 'display' configuration option is set to 'diagram')r   r   _repr_html_innerrD   s    r   _repr_html_zBaseEstimator._repr_html_^  s:     <<	"i//   
 $$r!   c                      t          |           S )zThis function is returned by the @property `_repr_html_` to make
        `hasattr(estimator, "_repr_html_") return `True` or `False` depending
        on `get_config()["display"]`.
        r   rD   s    r   r   zBaseEstimator._repr_html_innern  s    
 #4(((r!   c                 |    dt          |           i}t                      d         dk    rt          |           |d<   |S )z8Mime bundle used by jupyter kernels to display estimatorz
text/plainr   r   z	text/html)r1   r   r   )rE   kwargsr   s      r   _repr_mimebundle_zBaseEstimator._repr_mimebundle_u  s=    T

+<<	"i//"5d";";F;r!   )T)r|   )r   r   TF)rr   rn   __qualname____doc__classmethodrW   r"   rt   r   r   r   r   r   r   r   r   r   propertyr   r   r   __classcell__)r2   s   @r   r@   r@   p   s_         4 4 [4<   0= = =~2 2 2 2h    ,( ( ( ( ((  	 	 	, , ,\W& W& W&v 
!k k k kZ
 
 
 % % X%) ) )      r!   r@   c                   $    e Zd ZdZdZddZd ZdS )ClassifierMixinz0Mixin class for all classifiers in scikit-learn.
classifierNc                 P    ddl m}  |||                     |          |          S )a  
        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 : array-like of shape (n_samples, n_features)
            Test samples.

        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`.
        r   )accuracy_scoresample_weight)metricsr   predict)rE   r   r   r   r   s        r   scorezClassifierMixin.score  s7    0 	,+++++~aaNNNNr!   c                 
    ddiS Nr   Tr&   rD   s    r   r   zClassifierMixin._more_tags      d##r!   r   rr   rn   r   r   _estimator_typer   r   r&   r!   r   r   r   }  sF        ::"OO O O O8$ $ $ $ $r!   r   c                   $    e Zd ZdZdZddZd ZdS )RegressorMixinz:Mixin class for all regression estimators in scikit-learn.	regressorNc                 T    ddl m} |                     |          } ||||          S )a  Return the coefficient of determination of the prediction.

        The coefficient of determination :math:`R^2` is defined as
        :math:`(1 - \frac{u}{v})`, where :math:`u` is the residual
        sum of squares ``((y_true - y_pred)** 2).sum()`` and :math:`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 :math:`R^2` score of 0.0.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Test samples. For some estimators this may be a precomputed
            kernel matrix or a list of generic objects instead with shape
            ``(n_samples, n_samples_fitted)``, where ``n_samples_fitted``
            is the number of samples used in the fitting for the estimator.

        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
            :math:`R^2` of ``self.predict(X)`` w.r.t. `y`.

        Notes
        -----
        The :math:`R^2` score used when calling ``score`` on a regressor uses
        ``multioutput='uniform_average'`` from version 0.23 to keep consistent
        with default value of :func:`~sklearn.metrics.r2_score`.
        This influences the ``score`` method of all the multioutput
        regressors (except for
        :class:`~sklearn.multioutput.MultiOutputRegressor`).
        r   )r2_scorer   )r   r  r   )rE   r   r   r   r  y_preds         r   r   zRegressorMixin.score  s=    R 	&%%%%%ax6????r!   c                 
    ddiS r   r&   rD   s    r   r   zRegressorMixin._more_tags  r   r!   r   r   r&   r!   r   r   r     sG        DD!O,@ ,@ ,@ ,@\$ $ $ $ $r!   r   c                   $    e Zd ZdZdZddZd ZdS )ClusterMixinz7Mixin class for all cluster estimators in scikit-learn.	clustererNc                 :    |                      |           | j        S )a  
        Perform clustering on `X` and returns cluster labels.

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

        y : Ignored
            Not used, present for API consistency by convention.

        Returns
        -------
        labels : ndarray of shape (n_samples,), dtype=np.int64
            Cluster labels.
        )fitlabels_rE   r   r   s      r   fit_predictzClusterMixin.fit_predict  s    & 	|r!   c                 
    dg iS )Npreserves_dtyper&   rD   s    r   r   zClusterMixin._more_tags  s    !2&&r!   r   )rr   rn   r   r   r   r  r   r&   r!   r   r  r    sB        AA!O   ,' ' ' ' 'r!   r  c                   :    e Zd ZdZed             Zd Zd Zd ZdS )BiclusterMixinz9Mixin class for all bicluster estimators in scikit-learn.c                     | j         | j        fS )z{Convenient way to get row and column indicators together.

        Returns the ``rows_`` and ``columns_`` members.
        )rows_columns_rD   s    r   biclusters_zBiclusterMixin.biclusters_  s     z4=((r!   c                     | j         |         }| j        |         }t          j        |          d         t          j        |          d         fS )a  Row and column indices of the `i`'th bicluster.

        Only works if ``rows_`` and ``columns_`` attributes exist.

        Parameters
        ----------
        i : int
            The index of the cluster.

        Returns
        -------
        row_ind : ndarray, dtype=np.intp
            Indices of rows in the dataset that belong to the bicluster.
        col_ind : ndarray, dtype=np.intp
            Indices of columns in the dataset that belong to the bicluster.
        r   )r  r  r   nonzero)rE   r   rowscolumnss       r   get_indiceszBiclusterMixin.get_indices  sD    " z!}-"z$"BJw$7$7$:::r!   c                 ^    |                      |          }t          d |D                       S )a-  Shape of the `i`'th bicluster.

        Parameters
        ----------
        i : int
            The index of the cluster.

        Returns
        -------
        n_rows : int
            Number of rows in the bicluster.

        n_cols : int
            Number of columns in the bicluster.
        c              3   4   K   | ]}t          |          V  d S r   )r   )r   r   s     r   r^   z+BiclusterMixin.get_shape.<locals>.<genexpr>)  s(      --SVV------r!   )r  r)   )rE   r   indicess      r   	get_shapezBiclusterMixin.get_shape  s4      ""1%%--W------r!   c                     ddl m}  ||d          }|                     |          \  }}||ddt          j        f         |f         S )a   Return the submatrix corresponding to bicluster `i`.

        Parameters
        ----------
        i : int
            The index of the cluster.
        data : array-like of shape (n_samples, n_features)
            The data.

        Returns
        -------
        submatrix : ndarray of shape (n_rows, n_cols)
            The submatrix corresponding to bicluster `i`.

        Notes
        -----
        Works with sparse matrices. Only works if ``rows_`` and
        ``columns_`` attributes exist.
        r   r   csr)accept_sparseN)utils.validationr   r  r   newaxis)rE   r   datar   row_indcol_inds         r   get_submatrixzBiclusterMixin.get_submatrix+  sa    ( 	211111{4u555++A..GAAArzM*G344r!   N)	rr   rn   r   r   r   r  r  r  r'  r&   r!   r   r  r    s`        CC) ) X); ; ;*. . .&5 5 5 5 5r!   r  c                       e Zd ZdZddZdS )TransformerMixina  Mixin class for all transformers in scikit-learn.

    If :term:`get_feature_names_out` is defined, then `BaseEstimator` will
    automatically wrap `transform` and `fit_transform` to follow the `set_output`
    API. See the :ref:`developer_api_set_output` for details.

    :class:`base.OneToOneFeatureMixin` and
    :class:`base.ClassNamePrefixFeaturesOutMixin` are helpful mixins for
    defining :term:`get_feature_names_out`.
    Nc                     |! | j         |fi |                    |          S  | j         ||fi |                    |          S )a  
        Fit to data, then transform it.

        Fits transformer to `X` and `y` with optional parameters `fit_params`
        and returns a transformed version of `X`.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Input samples.

        y :  array-like of shape (n_samples,) or (n_samples, n_outputs),                 default=None
            Target values (None for unsupervised transformations).

        **fit_params : dict
            Additional fit parameters.

        Returns
        -------
        X_new : ndarray array of shape (n_samples, n_features_new)
            Transformed array.
        )r
  	transform)rE   r   r   
fit_paramss       r   fit_transformzTransformerMixin.fit_transformR  s]    4 948A,,,,66q999 48Aq//J//99!<<<r!   r   )rr   rn   r   r   r-  r&   r!   r   r)  r)  F  s2        	 	= = = = = =r!   r)  c                       e Zd ZdZddZdS )OneToOneFeatureMixinzProvides `get_feature_names_out` for simple transformers.

    This mixin assumes there's a 1-to-1 correspondence between input features
    and output features, such as :class:`~preprocessing.StandardScaler`.
    Nc                 "    t          | |          S )a  Get output feature names for transformation.

        Parameters
        ----------
        input_features : array-like of str or None, default=None
            Input features.

            - If `input_features` is `None`, then `feature_names_in_` is
              used as feature names in. If `feature_names_in_` is not defined,
              then the following input feature names are generated:
              `["x0", "x1", ..., "x(n_features_in_ - 1)"]`.
            - If `input_features` is an array-like, then `input_features` must
              match `feature_names_in_` if `feature_names_in_` is defined.

        Returns
        -------
        feature_names_out : ndarray of str objects
            Same as input features.
        r   rE   input_featuress     r   get_feature_names_outz*OneToOneFeatureMixin.get_feature_names_out{  s    ( 't^<<<r!   r   rr   rn   r   r   r3  r&   r!   r   r/  r/  t  s2         = = = = = =r!   r/  c                       e Zd ZdZddZdS )ClassNamePrefixFeaturesOutMixinaE  Mixin class for transformers that generate their own names by prefixing.

    This mixin is useful when the transformer needs to generate its own feature
    names out, such as :class:`~decomposition.PCA`. For example, if
    :class:`~decomposition.PCA` outputs 3 features, then the generated feature
    names out are: `["pca0", "pca1", "pca2"]`.

    This mixin assumes that a `_n_features_out` attribute is defined when the
    transformer is fitted. `_n_features_out` is the number of output features
    that the transformer will return in `transform` of `fit_transform`.
    Nc                 P    t          | d           t          | | j        |          S )aL  Get output feature names for transformation.

        The feature names out will prefixed by the lowercased class name. For
        example, if the transformer outputs 3 features, then the feature names
        out are: `["class_name0", "class_name1", "class_name2"]`.

        Parameters
        ----------
        input_features : array-like of str or None, default=None
            Only used to validate feature names with the names seen in :meth:`fit`.

        Returns
        -------
        feature_names_out : ndarray of str objects
            Transformed feature names.
        _n_features_out)r2  )r   r   r8  r1  s     r   r3  z5ClassNamePrefixFeaturesOutMixin.get_feature_names_out  s6    " 	/000.$&~
 
 
 	
r!   r   r4  r&   r!   r   r6  r6    s2        
 

 
 
 
 
 
r!   r6  c                       e Zd ZdZdZddZdS )DensityMixinz7Mixin class for all density estimators in scikit-learn.DensityEstimatorNc                     dS )a=  Return the score of the model on the data `X`.

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

        y : Ignored
            Not used, present for API consistency by convention.

        Returns
        -------
        score : float
        Nr&   r  s      r   r   zDensityMixin.score  s	     	r!   r   )rr   rn   r   r   r   r   r&   r!   r   r:  r:    s3        AA(O     r!   r:  c                       e Zd ZdZdZddZdS )OutlierMixinzAMixin class for all outlier detection estimators in scikit-learn.outlier_detectorNc                 R    |                      |                              |          S )a  Perform fit on X and returns labels for X.

        Returns -1 for outliers and 1 for inliers.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input samples.

        y : Ignored
            Not used, present for API consistency by convention.

        Returns
        -------
        y : ndarray of shape (n_samples,)
            1 for inliers, -1 for outliers.
        )r
  r   r  s      r   r  zOutlierMixin.fit_predict  s"    & xx{{""1%%%r!   r   )rr   rn   r   r   r   r  r&   r!   r   r>  r>    s3        KK(O& & & & & &r!   r>  c                       e Zd ZdgZdS )MetaEstimatorMixinr5   N)rr   rn   r   _required_parametersr&   r!   r   rB  rB    s        '=>>r!   rB  c                       e Zd ZdZd ZdS )MultiOutputMixinz2Mixin to mark estimators that support multioutput.c                 
    ddiS )NmultioutputTr&   rD   s    r   r   zMultiOutputMixin._more_tags  s    t$$r!   Nrr   rn   r   r   r   r&   r!   r   rE  rE    s)        <<% % % % %r!   rE  c                       e Zd ZdZd ZdS )_UnstableArchMixinz=Mark estimators that are non-determinstic on 32bit or PowerPCc                 `    dt           p%t          j                                        d          iS )Nnon_deterministic)ppcpowerpc)r   platformmachinero   rD   s    r   r   z_UnstableArchMixin._more_tags  s/    NX-//::;MNN
 	
r!   NrH  r&   r!   r   rJ  rJ    s)        GG
 
 
 
 
r!   rJ  c                 ,    t          | dd          dk    S )a  Return True if the given estimator is (probably) a classifier.

    Parameters
    ----------
    estimator : object
        Estimator object to test.

    Returns
    -------
    out : bool
        True if estimator is a classifier and False otherwise.
    r   Nr   rK   r5   s    r   is_classifierrT    s     9/66,FFr!   c                 ,    t          | dd          dk    S )a  Return True if the given estimator is (probably) a regressor.

    Parameters
    ----------
    estimator : estimator instance
        Estimator object to test.

    Returns
    -------
    out : bool
        True if estimator is a regressor and False otherwise.
    r   Nr  rR  rS  s    r   is_regressorrV    s     9/66+EEr!   c                 ,    t          | dd          dk    S )a  Return True if the given estimator is (probably) an outlier detector.

    Parameters
    ----------
    estimator : estimator instance
        Estimator object to test.

    Returns
    -------
    out : bool
        True if estimator is an outlier detector and False otherwise.
    r   Nr?  rR  rS  s    r   is_outlier_detectorrX    s     9/66:LLLr!   )2r   r.   rp   collectionsr   rO  rN   r   numpyr   r   r   _configr   utilsr   utils._set_outputr   utils._tagsr
   r"  r   r   r   r   r   r   r   r   utils._estimator_html_reprr   utils._param_validationr   r   r@   r   r   r  r  r)  r/  r6  r:  r>  rB  rE  rJ  rT  rV  rX  r&   r!   r   <module>ra     s   & &
   # # # # # #   				                       . . . . . .      ( ' ' ' ' ' ) ) ) ) ) ) & & & & & & + + + + + + 5 5 5 5 5 5 = = = = = = - - - - - - 0 0 0 0 0 0 ; ; ; ; ; ; C C C C C C " K K K K K\J J J J J J J JZ"$ "$ "$ "$ "$ "$ "$ "$J4$ 4$ 4$ 4$ 4$ 4$ 4$ 4$n' ' ' ' ' ' ' '>K5 K5 K5 K5 K5 K5 K5 K5\+= += += += += += += +=\= = = = = = = =<!
 !
 !
 !
 !
 !
 !
 !
H       .& & & & & & & &6? ? ? ? ? ? ? ?
% % % % % % % %
 
 
 
 
 
 
 
G G G F F F M M M M Mr!   