
    0PhJ                       d Z ddlZddlmZmZ ddlmZ ddlm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 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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/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6 ddl7m8Z8m9Z9 g dZ:ed             Z;d Z<d Z= G d de2          Z>d Z?dddd d!Z@d*d"ZA	 d+d$ZBd+d%ZC G d& d'ee2          ZDddd(d)ZEdS ),zQUtilities to build a composite estimator as a chain of transforms and estimators.    N)Counterdefaultdict)contextmanager)deepcopy)chainislice)sparse   )TransformerMixin_fit_contextclone)NotFittedError)FunctionTransformer)Bunch)_VisualBlock)METHODS)
HasMethodsHidden)_get_container_adapter_safe_set_output)get_tags)_print_elapsed_time)"_deprecate_Xt_in_inverse_transform)MetadataRouterMethodMapping_raise_for_params_routing_enabledget_routing_for_objectprocess_routing)_BaseCompositionavailable_if)Paralleldelayed)check_is_fittedcheck_memory)PipelineFeatureUnionmake_pipeline
make_unionc              #      K   	 dV  n"# t           $ r}t          d          |d}~ww xY w	 t          |            dS # t           $ r t          j        dt                     Y dS w xY w)a  A context manager to make sure a NotFittedError is raised, if a sub-estimator
    raises the error.

    Otherwise, we raise a warning if the pipeline is not fitted, with the deprecation.

    TODO(1.8): remove this context manager and replace with check_is_fitted.
    NzPipeline is not fitted yet.zThis Pipeline instance is not fitted yet. Call 'fit' with appropriate arguments before using other methods such as transform, predict, etc. This will raise an error in 1.8 instead of the current warning.)r   r$   warningswarnFutureWarning)	estimatorexcs     P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sklearn/pipeline.py_raise_or_warn_if_not_fittedr1   ,   s      E E E E:;;DE	
	""""" 
 
 
 	
 	
 	
 	
 	
 	

s   	 
(#(= $A%$A%c                       fd}|S )z\Check that final_estimator has `attr`.

    Used together with `available_if` in `Pipeline`.c                 2    t          | j                   dS NT)getattr_final_estimator)selfattrs    r0   checkz#_final_estimator_has.<locals>.checkL   s    %t,,,t     )r8   r9   s   ` r0   _final_estimator_hasr<   G   s#    
    
 Lr:   c                     ||vrFt          |t                    r t           fd|D                       ||<   n  j        |fi ||<   ||         S )a  Transform a parameter value using a sub-pipeline and cache the result.

    Parameters
    ----------
    sub_pipeline : Pipeline
        The sub-pipeline to be used for transformation.
    cache : dict
        The cache dictionary to store the transformed values.
    param_name : str
        The name of the parameter to be transformed.
    param_value : object
        The value of the parameter to be transformed.
    transform_params : dict
        The metadata to be used for transformation. This passed to the
        `transform` method of the sub-pipeline.

    Returns
    -------
    transformed_value : object
        The transformed value of the parameter.
    c              3   4   K   | ]} j         |fi V  d S N	transform).0elementsub_pipelinetransform_paramss     r0   	<genexpr>z$_cached_transform.<locals>.<genexpr>r   sM       & & '&wCC2BCC& & & & & &r:   )
isinstancetuplerA   )rD   cache
param_nameparam_valuerE   s   `   `r0   _cached_transformrL   T   s    0 
 k5)) 	X % & & & & &*& & & ! !E*
 !7 6{ W WFV W WE*r:   c                       e Zd ZU dZe ee          gedgde edg          gdgdZ	e
ed<   ddddd	Zdd
dZd9dZd Zd Zd:dZd Zd Zed             Zed             Zed             Zd Zd Zd Zd;dZ ed          d<d            Zd Z ee           ed          d<d                        Z  e e!d                    d             Z" e e!d                      ed          d<d!                        Z# e e!d"                    d#             Z$ e e!d$                    d%             Z% e e!d&                    d'             Z& e e!d(                    d)             Z'd* Z( ee(          d+             Z)d, Z* ee*          d<dd-d.            Z+ e e!d/                    d=d0            Z,ed1             Z- fd2Z.d<d3Z/ed4             Z0ed5             Z1d6 Z2d7 Z3d8 Z4 xZ5S )>r&   a  
    A sequence of data transformers with an optional final predictor.

    `Pipeline` allows you to sequentially apply a list of transformers to
    preprocess the data and, if desired, conclude the sequence with a final
    :term:`predictor` for predictive modeling.

    Intermediate steps of the pipeline must be transformers, that is, they
    must implement `fit` and `transform` methods.
    The final :term:`estimator` only needs to implement `fit`.
    The transformers in the pipeline can be cached using ``memory`` argument.

    The purpose of the pipeline is to assemble several steps that can be
    cross-validated together while setting different parameters. For this, it
    enables setting parameters of the various steps using their names and the
    parameter name separated by a `'__'`, as in the example below. A step's
    estimator may be replaced entirely by setting the parameter with its name
    to another estimator, or a transformer removed by setting it to
    `'passthrough'` or `None`.

    For an example use case of `Pipeline` combined with
    :class:`~sklearn.model_selection.GridSearchCV`, refer to
    :ref:`sphx_glr_auto_examples_compose_plot_compare_reduction.py`. The
    example :ref:`sphx_glr_auto_examples_compose_plot_digits_pipe.py` shows how
    to grid search on a pipeline using `'__'` as a separator in the parameter names.

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

    .. versionadded:: 0.5

    Parameters
    ----------
    steps : list of tuples
        List of (name of step, estimator) tuples that are to be chained in
        sequential order. To be compatible with the scikit-learn API, all steps
        must define `fit`. All non-last steps must also define `transform`. See
        :ref:`Combining Estimators <combining_estimators>` for more details.

    transform_input : list of str, default=None
        The names of the :term:`metadata` parameters that should be transformed by the
        pipeline before passing it to the step consuming it.

        This enables transforming some input arguments to ``fit`` (other than ``X``)
        to be transformed by the steps of the pipeline up to the step which requires
        them. Requirement is defined via :ref:`metadata routing <metadata_routing>`.
        For instance, this can be used to pass a validation set through the pipeline.

        You can only set this if metadata routing is enabled, which you
        can enable using ``sklearn.set_config(enable_metadata_routing=True)``.

        .. versionadded:: 1.6

    memory : str or object with the joblib.Memory interface, default=None
        Used to cache the fitted transformers of the pipeline. The last step
        will never be cached, even if it is a transformer. By default, no
        caching is performed. If a string is given, it is the path to the
        caching directory. Enabling caching triggers a clone of the transformers
        before fitting. Therefore, the transformer instance given to the
        pipeline cannot be inspected directly. Use the attribute ``named_steps``
        or ``steps`` to inspect estimators within the pipeline. Caching the
        transformers is advantageous when fitting is time consuming. See
        :ref:`sphx_glr_auto_examples_neighbors_plot_caching_nearest_neighbors.py`
        for an example on how to enable caching.

    verbose : bool, default=False
        If True, the time elapsed while fitting each step will be printed as it
        is completed.

    Attributes
    ----------
    named_steps : :class:`~sklearn.utils.Bunch`
        Dictionary-like object, with the following attributes.
        Read-only attribute to access any step parameter by user given name.
        Keys are step names and values are steps parameters.

    classes_ : ndarray of shape (n_classes,)
        The classes labels. Only exist if the last step of the pipeline is a
        classifier.

    n_features_in_ : int
        Number of features seen during :term:`fit`. Only defined if the
        underlying first estimator in `steps` exposes such an attribute
        when fit.

        .. versionadded:: 0.24

    feature_names_in_ : ndarray of shape (`n_features_in_`,)
        Names of features seen during :term:`fit`. Only defined if the
        underlying estimator exposes such an attribute when fit.

        .. versionadded:: 1.0

    See Also
    --------
    make_pipeline : Convenience function for simplified pipeline construction.

    Examples
    --------
    >>> from sklearn.svm import SVC
    >>> from sklearn.preprocessing import StandardScaler
    >>> from sklearn.datasets import make_classification
    >>> from sklearn.model_selection import train_test_split
    >>> from sklearn.pipeline import Pipeline
    >>> X, y = make_classification(random_state=0)
    >>> X_train, X_test, y_train, y_test = train_test_split(X, y,
    ...                                                     random_state=0)
    >>> pipe = Pipeline([('scaler', StandardScaler()), ('svc', SVC())])
    >>> # The pipeline can be used as any other estimator
    >>> # and avoids leaking the test set into the train set
    >>> pipe.fit(X_train, y_train).score(X_test, y_test)
    0.88
    >>> # An estimator's parameter can be set using '__' syntax
    >>> pipe.set_params(svc__C=10).fit(X_train, y_train).score(X_test, y_test)
    0.76
    NrI   booleanstepstransform_inputmemoryverbose_parameter_constraintsFrQ   rR   rS   c                >    || _         || _        || _        || _        d S r?   rO   )r7   rP   rQ   rR   rS   s        r0   __init__zPipeline.__init__   s#    
.r:   r@   c                ^    |                                  D ]\  }}}t          ||           | S )a  Set the output container when `"transform"` and `"fit_transform"` are called.

        Calling `set_output` will set the output of all estimators in `steps`.

        Parameters
        ----------
        transform : {"default", "pandas", "polars"}, default=None
            Configure output of `transform` and `fit_transform`.

            - `"default"`: Default output format of a transformer
            - `"pandas"`: DataFrame output
            - `"polars"`: Polars output
            - `None`: Transform configuration is unchanged

            .. versionadded:: 1.4
                `"polars"` option was added.

        Returns
        -------
        self : estimator instance
            Estimator instance.
        r@   )_iterr   )r7   rA   _steps       r0   
set_outputzPipeline.set_output   s<    . **,, 	8 	8JAq$TY77777r:   Tc                 0    |                      d|          S )a  Get parameters for this estimator.

        Returns the parameters given in the constructor as well as the
        estimators contained within the `steps` of the `Pipeline`.

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

        Returns
        -------
        params : mapping of string to any
            Parameter names mapped to their values.
        rP   deep_get_paramsr7   r_   s     r0   
get_paramszPipeline.get_params  s    " d333r:   c                       | j         di | | S )aC  Set the parameters of this estimator.

        Valid parameter keys can be listed with ``get_params()``. Note that
        you can directly set the parameters of the estimators contained in
        `steps`.

        Parameters
        ----------
        **kwargs : dict
            Parameters of this estimator or parameters of estimators contained
            in `steps`. Parameters of the steps may be set using its name and
            the parameter name separated by a '__'.

        Returns
        -------
        self : object
            Pipeline class instance.
        rP   )rP   _set_paramsr7   kwargss     r0   
set_paramszPipeline.set_params-  s"    & 	++F+++r:   c           	         t          | j         \  }}|                     |           |d d         }|d         }|D ]^}||dk    rt          |d          st          |d          rt          |d          s#t	          d|dt          |          d          _|9|dk    r5t          |d          s't	          d	|dt          |          d          d S d S d S )
Npassthroughfitfit_transformrA   znAll intermediate steps should be transformers and implement fit and transform or be the string 'passthrough' '' (type 	) doesn'tzLLast step of Pipeline should implement fit or be the string 'passthrough'. ')ziprP   _validate_nameshasattr	TypeErrortype)r7   names
estimatorstransformersr.   ts         r0   _validate_stepszPipeline._validate_stepsC  s<   ,z 	U### "#2#rN	 	 	AyA..Au%% O)D)D W;N N   i 1247777<   !]**Iu-- + ) -6IItIH  	 "!****r:   c              #      K   t          | j                  }|s|dz  }t          t          | j        d|                    D ]!\  }\  }}|s|||fV  ||dk    r|||fV  "dS )z
        Generate (idx, (name, trans)) tuples from self.steps

        When filter_passthrough is True, 'passthrough' and None transformers
        are filtered out.
        r
   r   Nrl   )lenrP   	enumerater   )r7   
with_finalfilter_passthroughstopidxnametranss          r0   rY   zPipeline._iterf  s       4: 	AID"+F4:q$,G,G"H"H 	' 	'C$% '4&&&&&"u'='=4&&&&		' 	'r:   c                 *    t          | j                  S )z4
        Returns the length of the Pipeline
        )r|   rP   r7   s    r0   __len__zPipeline.__len__w  s     4:r:   c                    t          |t                    rE|j        dvrt          d          |                     | j        |         | j        | j                  S 	 | j        |         \  }}n# t          $ r | j	        |         cY S w xY w|S )ae  Returns a sub-pipeline or a single estimator in the pipeline

        Indexing with an integer will return an estimator; using a slice
        returns another Pipeline instance which copies a slice of this
        Pipeline. This copy is shallow: modifying (or fitting) estimators in
        the sub-pipeline will affect the larger pipeline and vice-versa.
        However, replacing a value in `step` will not affect a copy.

        See
        :ref:`sphx_glr_auto_examples_feature_selection_plot_feature_selection_pipeline.py`
        for an example of how to use slicing to inspect part of a pipeline.
        )r
   Nz*Pipeline slicing only supports a step of 1)rR   rS   )
rG   slicer[   
ValueError	__class__rP   rR   rS   rt   named_steps)r7   indr   ests       r0   __getitem__zPipeline.__getitem__}  s     c5!! 	xy(( !MNNN>>
3T\ "   	)
3ID## 	) 	) 	)#C((((	) 
s   A- -BBc                 D    | j         sdS | j         d         d         j        S )z;Return the estimator type of the last step in the pipeline.Nrk   r
   )rP   _estimator_typer   s    r0   r   zPipeline._estimator_type  s'     z 	4z"~a 00r:   c                 >    t          di t          | j                  S )zAccess the steps by name.

        Read-only attribute to access any step by given name.
        Keys are steps names and values are the steps objects.r;   )r   dictrP   r   s    r0   r   zPipeline.named_steps  s"     ((tDJ''(((r:   c                 r    	 | j         d         d         }|dn|S # t          t          t          f$ r Y d S w xY w)Nrk   r
   rl   )rP   r   AttributeErrorrt   )r7   r.   s     r0   r6   zPipeline._final_estimator  sQ    	
2q)I$-$5==9DNI6 	 	 	
 44	s    66c                 n    | j         sd S | j        |         \  }}d|dz   t          | j                  |fz  S )N(step %d of %d) Processing %sr
   )rS   rP   r|   )r7   step_idxr   rZ   s       r0   _log_messagezPipeline._log_message  s@    | 	4*X&a.(Q,DJQU1VVVr:   c                    t                      rt          | |fi ||}|S t          di d | j        D             }|                                D ]w\  }}d|vr"t          d                    |                    |                    dd          \  }}	|||         d         |	<   |||         d         |	<   |||         d         |	<   x|S )	Nc           	      P    i | ]#\  }}||t          di d t          D             $S )Nc                     i | ]}|i S r;   r;   )rB   methods     r0   
<dictcomp>z<Pipeline._check_method_params.<locals>.<dictcomp>.<dictcomp>  s    "D"D"D&62"D"D"Dr:   r;   )r   r   rB   r   r[   s      r0   r   z1Pipeline._check_method_params.<locals>.<dictcomp>  sK       "d' %EE"D"DG"D"D"DEE'''r:   __zPipeline.fit does not accept the {} parameter. You can pass parameters to specific steps of your pipeline using the stepname__parameter format, e.g. `Pipeline.fit(X, y, logisticregression__sample_weight=sample_weight)`.r
   rm   rn   fit_predictr;   )r   r   r   rP   itemsr   formatsplit)
r7   r   propsrh   routed_paramsfit_params_stepspnamepvalr[   params
             r0   _check_method_paramszPipeline._check_method_params  s    	$+D&LLELVLLM  $     &*j       %{{}} D Dtu$$$, -3F5MM   $kk$22e7; &u-e4 BF &7>?C &}5e<<##r:   c          	         | j         
r|r|dk    r|S | d|         }t          |          fd                                D             }t                      }t                      }|                                D ]b\  }}	t	                      ||<   |	                                D ]7\  }
}|
| j         v rt          |||
||          ||         |
<   ,|||         |
<   8c|S )a<  Get params (metadata) for step `name`.

        This transforms the metadata up to this step if required, which is
        indicated by the `transform_input` parameter.

        If a param in `step_params` is included in the `transform_input` list,
        it will be transformed.

        Parameters
        ----------
        step_idx : int
            Index of the step in the pipeline.

        step_params : dict
            Parameters specific to the step. These are routed parameters, e.g.
            `routed_params[name]`. If a parameter name here is included in the
            `pipeline.transform_input`, then it will be transformed. Note that
            these parameters are *after* routing, so the aliases are already
            resolved.

        all_params : dict
            All parameters passed by the user. Here this is used to call
            `transform` on the slice of the pipeline itself.

        Returns
        -------
        dict
            Parameters to be passed to the step. The ones which should be
            transformed are transformed.
        Nr   c                 r    i | ]3\  }}|                     d                                           v 0||4S )rA   )r   params)consumeskeys)rB   keyvalue
all_paramssub_metadata_routings      r0   r   z3Pipeline._get_metadata_for_step.<locals>.<dictcomp>  sc     
 
 
U#,,":??+<+< -      r:   )rI   rJ   rK   rE   )rQ   r   r   r   r   rL   )r7   r   step_paramsr   rD   rE   transformed_paramstransformed_cacher   method_paramsrJ   rK   r   s      `        @r0   _get_metadata_for_stepzPipeline._get_metadata_for_step  s[   @  ( ) ) 1}} IXI5lCC
 
 
 
 
(..00
 
 
 "VV FF
 &1%6%6%8%8 	I 	I!FM).v&+8+>+>+@+@ I I'
K !555 >O$/#-$/)9> > >&v.z:: >I&v.z::I "!r:   c                 v   t          | j                  | _        |                                  t          | j                  }|                    t                    }|                     dd          D ]\  }}}	|	|	dk    r<t          d| 	                    |                    5  	 ddd           ?# 1 swxY w Y   t          |d          r
|j        |	}
nt          |	          }
|                     |||         |          } ||
||dd| 	                    |          |          \  }}||f| j        |<   |S )	a
  Fit the pipeline except the last step.

        routed_params is the output of `process_routing`
        raw_params is the parameters passed by the user, used when `transform_input`
            is set by the user, to transform metadata using a sub-pipeline.
        Fr~   r   Nrl   r&   locationr   r   r   )weightmessage_clsnamemessager   )listrP   rz   r%   rR   rI   _fit_transform_onerY   r   r   rs   r   r   r   )r7   Xyr   
raw_paramsrR   fit_transform_one_cachedr   r   transformercloned_transformerr   fitted_transformers                r0   _fitzPipeline._fit)  s    $*%%
dk**#)<<0B#C#C +/:: ,6 ,
 ,
  	>  	>'HdK "k]&B&B(T5F5Fx5P5PQQ                 vz** 8v/F &1""%*;%7%7"55!)$/% 6  K %=$<" *))(33"% % %!A! %)*<#=DJx  s   $B22B6	9B6	)prefer_skip_nested_validationc                    t                      s| j        t          d          |                     d|          }|                     ||||          }t          d|                     t          | j                  dz
                      5  | j	        dk    rY| 
                    t          |           dz
  || j        d	         d
                  |          } | j	        j        ||fi |d          ddd           n# 1 swxY w Y   | S )a  Fit the model.

        Fit all the transformers one after the other and sequentially transform the
        data. Finally, fit the transformed data using the final estimator.

        Parameters
        ----------
        X : iterable
            Training data. Must fulfill input requirements of first step of the
            pipeline.

        y : iterable, default=None
            Training targets. Must fulfill label requirements for all steps of
            the pipeline.

        **params : dict of str -> object
            - If `enable_metadata_routing=False` (default): Parameters passed to the
              ``fit`` method of each step, where each parameter name is prefixed such
              that parameter ``p`` for step ``s`` has key ``s__p``.

            - If `enable_metadata_routing=True`: Parameters requested and accepted by
              steps. Each step must have requested certain metadata for these parameters
              to be forwarded to them.

            .. versionchanged:: 1.4
                Parameters are now passed to the ``transform`` method of the
                intermediate steps as well, if requested, and if
                `enable_metadata_routing=True` is set via
                :func:`~sklearn.set_config`.

            See :ref:`Metadata Routing User Guide <metadata_routing>` for more
            details.

        Returns
        -------
        self : object
            Pipeline with fitted steps.
        NzThe `transform_input` parameter can only be set if metadata routing is enabled. You can enable metadata routing using `sklearn.set_config(enable_metadata_routing=True)`.rm   r   r   )r   r&   r
   rl   rk   r   r   )r   rQ   r   r   r   r   r   r|   rP   r6   r   rm   )r7   r   r   r   r   Xtlast_step_paramss          r0   rm   zPipeline.fit[  ss   V  !! 	d&:&FF   11f1MMYYq!]vY>> T->->s4:QR?R-S-STT 	L 	L$55#'#>#> YY] -djnQ.? @% $? $ $ 
 *%)"aKK3CE3JKKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L s   A%C>>DDc                 l    | j         dk    p)t          | j         d          pt          | j         d          S )Nrl   rA   rn   r6   rs   r   s    r0   _can_fit_transformzPipeline._can_fit_transform  s<    !]2 ?t,k::?t,o>>	
r:   c                 f   |                      d|          }|                     |||          }| j        }t          d|                     t          | j                  dz
                      5  |dk    r|cddd           S |                     t          |           dz
  || j        d         d                  |	          }t          |d          r! |j	        ||fi |d         cddd           S   |j
        ||fi |d
         j        |fi |d         cddd           S # 1 swxY w Y   dS )a  Fit the model and transform with the final estimator.

        Fit all the transformers one after the other and sequentially transform
        the data. Only valid if the final estimator either implements
        `fit_transform` or `fit` and `transform`.

        Parameters
        ----------
        X : iterable
            Training data. Must fulfill input requirements of first step of the
            pipeline.

        y : iterable, default=None
            Training targets. Must fulfill label requirements for all steps of
            the pipeline.

        **params : dict of str -> object
            - If `enable_metadata_routing=False` (default): Parameters passed to the
              ``fit`` method of each step, where each parameter name is prefixed such
              that parameter ``p`` for step ``s`` has key ``s__p``.

            - If `enable_metadata_routing=True`: Parameters requested and accepted by
              steps. Each step must have requested certain metadata for these parameters
              to be forwarded to them.

            .. versionchanged:: 1.4
                Parameters are now passed to the ``transform`` method of the
                intermediate steps as well, if requested, and if
                `enable_metadata_routing=True`.

            See :ref:`Metadata Routing User Guide <metadata_routing>` for more
            details.

        Returns
        -------
        Xt : ndarray of shape (n_samples, n_transformed_features)
            Transformed samples.
        rn   r   r&   r
   rl   Nrk   r   r   rm   rA   )r   r   r6   r   r   r|   rP   r   rs   rn   rm   rA   )r7   r   r   r   r   r   	last_stepr   s           r0   rn   zPipeline.fit_transform  s   X 11PV1WWYYq!]++)	 T->->s4:QR?R-S-STT 	 	M))	 	 	 	 	 	 	 	  $::TQ)$*R.*;<!  ;    
 y/22 .y. -o> 	 	 	 	 	 	 	 	 Q}y}RFF.>u.EFFP *;7 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   .D&A#D&3&D&&D*-D*predictc                 ,   t          |           5  |}t                      s]|                     d          D ]\  }}}|                    |          } | j        d         d         j        |fi |cddd           S t          | dfi |}|                     d          D ]\  }}} |j        |fi ||         j        }  | j        d         d         j        |fi || j        d         d                  j        cddd           S # 1 swxY w Y   dS )a  Transform the data, and apply `predict` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls `predict`
        method. Only valid if the final estimator implements `predict`.

        Parameters
        ----------
        X : iterable
            Data to predict on. Must fulfill input requirements of first step
            of the pipeline.

        **params : dict of str -> object
            - If `enable_metadata_routing=False` (default): Parameters to the
              ``predict`` called at the end of all transformations in the pipeline.

            - If `enable_metadata_routing=True`: Parameters requested and accepted by
              steps. Each step must have requested certain metadata for these parameters
              to be forwarded to them.

            .. versionadded:: 0.20

            .. versionchanged:: 1.4
                Parameters are now passed to the ``transform`` method of the
                intermediate steps as well, if requested, and if
                `enable_metadata_routing=True` is set via
                :func:`~sklearn.set_config`.

            See :ref:`Metadata Routing User Guide <metadata_routing>` for more
            details.

            Note that while this may be used to return uncertainties from some
            models with ``return_std`` or ``return_cov``, uncertainties that are
            generated by the transformations in the pipeline are not propagated
            to the final estimator.

        Returns
        -------
        y_pred : ndarray
            Result of calling `predict` on the final estimator.
        Fr~   rk   r
   Nr   r   )r1   r   rY   rA   rP   r   r   r7   r   r   r   rZ   r   rA   r   s           r0   r   zPipeline.predict  s   X *$// 	 	B#%% ?*.****F*F 1 1&AtY",,R00BB0tz"~a(0>>v>>	 	 	 	 	 	 	 	 ,D)FFvFFM&*jjEj&B&B N N"4(Y(MM}T/B/LMM,4:b>!$, #DJrN1$56> 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   A!D	>A>D		DDr   c           	         |                      d|          }|                     |||          }|| j        d         d                  }t          d|                     t          | j                  dz
                      5   | j        d         d         j        ||fi |                    di           }ddd           n# 1 swxY w Y   |S )a  Transform the data, and apply `fit_predict` with the final estimator.

        Call `fit_transform` of each transformer in the pipeline. The
        transformed data are finally passed to the final estimator that calls
        `fit_predict` method. Only valid if the final estimator implements
        `fit_predict`.

        Parameters
        ----------
        X : iterable
            Training data. Must fulfill input requirements of first step of
            the pipeline.

        y : iterable, default=None
            Training targets. Must fulfill label requirements for all steps
            of the pipeline.

        **params : dict of str -> object
            - If `enable_metadata_routing=False` (default): Parameters to the
              ``predict`` called at the end of all transformations in the pipeline.

            - If `enable_metadata_routing=True`: Parameters requested and accepted by
              steps. Each step must have requested certain metadata for these parameters
              to be forwarded to them.

            .. versionadded:: 0.20

            .. versionchanged:: 1.4
                Parameters are now passed to the ``transform`` method of the
                intermediate steps as well, if requested, and if
                `enable_metadata_routing=True`.

            See :ref:`Metadata Routing User Guide <metadata_routing>` for more
            details.

            Note that while this may be used to return uncertainties from some
            models with ``return_std`` or ``return_cov``, uncertainties that are
            generated by the transformations in the pipeline are not propagated
            to the final estimator.

        Returns
        -------
        y_pred : ndarray
            Result of calling `fit_predict` on the final estimator.
        r   r   rk   r   r&   r
   N)r   r   rP   r   r   r|   r   get)r7   r   r   r   r   r   params_last_stepy_preds           r0   r   zPipeline.fit_predict  s   f 11f1UUYYq!]++(B):; T->->s4:QR?R-S-STT 	 	2TZ^A&2A )--mR@@ F	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 s    5CCCpredict_probac                 ,   t          |           5  |}t                      s]|                     d          D ]\  }}}|                    |          } | j        d         d         j        |fi |cddd           S t          | dfi |}|                     d          D ]\  }}} |j        |fi ||         j        }  | j        d         d         j        |fi || j        d         d                  j        cddd           S # 1 swxY w Y   dS )a  Transform the data, and apply `predict_proba` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls
        `predict_proba` method. Only valid if the final estimator implements
        `predict_proba`.

        Parameters
        ----------
        X : iterable
            Data to predict on. Must fulfill input requirements of first step
            of the pipeline.

        **params : dict of str -> object
            - If `enable_metadata_routing=False` (default): Parameters to the
              `predict_proba` called at the end of all transformations in the pipeline.

            - If `enable_metadata_routing=True`: Parameters requested and accepted by
              steps. Each step must have requested certain metadata for these parameters
              to be forwarded to them.

            .. versionadded:: 0.20

            .. versionchanged:: 1.4
                Parameters are now passed to the ``transform`` method of the
                intermediate steps as well, if requested, and if
                `enable_metadata_routing=True`.

            See :ref:`Metadata Routing User Guide <metadata_routing>` for more
            details.

        Returns
        -------
        y_proba : ndarray of shape (n_samples, n_classes)
            Result of calling `predict_proba` on the final estimator.
        Fr   rk   r
   Nr   r   )r1   r   rY   rA   rP   r   r   r   s           r0   r   zPipeline.predict_proba[  s   N *$// 	 	B#%% E*.****F*F 1 1&AtY",,R00BB6tz"~a(6rDDVDD	 	 	 	 	 	 	 	 ,D/LLVLLM&*jjEj&B&B N N"4(Y(MM}T/B/LMM24:b>!$2 #DJrN1$56D 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   decision_functionc           
         t          |           5  t          || d           t          | dfi |}|}|                     d          D ]<\  }}} |j        |fi |                    |i                               di           }= | j        d         d         j        |fi |                    | j        d         d         i                               di           cddd           S # 1 swxY w Y   dS )	aJ  Transform the data, and apply `decision_function` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls
        `decision_function` method. Only valid if the final estimator
        implements `decision_function`.

        Parameters
        ----------
        X : iterable
            Data to predict on. Must fulfill input requirements of first step
            of the pipeline.

        **params : dict of string -> object
            Parameters requested and accepted by steps. Each step must have
            requested certain metadata for these parameters to be forwarded to
            them.

            .. versionadded:: 1.4
                Only available if `enable_metadata_routing=True`. See
                :ref:`Metadata Routing User Guide <metadata_routing>` for more
                details.

        Returns
        -------
        y_score : ndarray of shape (n_samples, n_classes)
            Result of calling `decision_function` on the final estimator.
        r   Fr   rA   rk   r
   r   N)r1   r   r   rY   rA   r   rP   r   r7   r   r   r   r   rZ   r   rA   s           r0   r   zPipeline.decision_function  sn   > *$// 	 	fd,?@@@ ,D2EPPPPMB&*jjEj&B&B  "4(Y( '++D"5599+rJJ  74:b>!$6 ##DJrN1$5r::>>?RTVWW 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   CC))C-0C-score_samplesc                    t          |           5  |}|                     d          D ]\  }}}|                    |          }| j        d         d                             |          cddd           S # 1 swxY w Y   dS )a  Transform the data, and apply `score_samples` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls
        `score_samples` method. Only valid if the final estimator implements
        `score_samples`.

        Parameters
        ----------
        X : iterable
            Data to predict on. Must fulfill input requirements of first step
            of the pipeline.

        Returns
        -------
        y_score : ndarray of shape (n_samples,)
            Result of calling `score_samples` on the final estimator.
        Fr   rk   r
   N)r1   rY   rA   rP   r   )r7   r   r   rZ   r   s        r0   r   zPipeline.score_samples  s    * *$// 	7 	7B%)ZZ5Z%A%A / /!1k **2..:b>!$22266		7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   AA77A;>A;predict_log_probac                 ,   t          |           5  |}t                      s]|                     d          D ]\  }}}|                    |          } | j        d         d         j        |fi |cddd           S t          | dfi |}|                     d          D ]\  }}} |j        |fi ||         j        }  | j        d         d         j        |fi || j        d         d                  j        cddd           S # 1 swxY w Y   dS )a  Transform the data, and apply `predict_log_proba` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls
        `predict_log_proba` method. Only valid if the final estimator
        implements `predict_log_proba`.

        Parameters
        ----------
        X : iterable
            Data to predict on. Must fulfill input requirements of first step
            of the pipeline.

        **params : dict of str -> object
            - If `enable_metadata_routing=False` (default): Parameters to the
              `predict_log_proba` called at the end of all transformations in the
              pipeline.

            - If `enable_metadata_routing=True`: Parameters requested and accepted by
              steps. Each step must have requested certain metadata for these parameters
              to be forwarded to them.

            .. versionadded:: 0.20

            .. versionchanged:: 1.4
                Parameters are now passed to the ``transform`` method of the
                intermediate steps as well, if requested, and if
                `enable_metadata_routing=True`.

            See :ref:`Metadata Routing User Guide <metadata_routing>` for more
            details.

        Returns
        -------
        y_log_proba : ndarray of shape (n_samples, n_classes)
            Result of calling `predict_log_proba` on the final estimator.
        Fr   rk   r
   Nr   r   )r1   r   rY   rA   rP   r   r   r   s           r0   r   zPipeline.predict_log_proba  s   P *$// 	 	B#%% I*.****F*F 1 1&AtY",,R00BB:tz"~a(:2HHHH	 	 	 	 	 	 	 	 ,D2EPPPPM&*jjEj&B&B N N"4(Y(MM}T/B/LMM64:b>!$6 #DJrN1$56H 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                 B    | j         dk    pt          | j         d          S )Nrl   rA   r   r   s    r0   _can_transformzPipeline._can_transform  s+    $5 
!;:
 :
 	
r:   c                    t          |           5  t          || d           t          | dfi |}|}|                                 D ]\  }}} |j        |fi ||         j        } |cddd           S # 1 swxY w Y   dS )a  Transform the data, and apply `transform` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls
        `transform` method. Only valid if the final estimator
        implements `transform`.

        This also works where final estimator is `None` in which case all prior
        transformations are applied.

        Parameters
        ----------
        X : iterable
            Data to transform. Must fulfill input requirements of first step
            of the pipeline.

        **params : dict of str -> object
            Parameters requested and accepted by steps. Each step must have
            requested certain metadata for these parameters to be forwarded to
            them.

            .. versionadded:: 1.4
                Only available if `enable_metadata_routing=True`. See
                :ref:`Metadata Routing User Guide <metadata_routing>` for more
                details.

        Returns
        -------
        Xt : ndarray of shape (n_samples, n_transformed_features)
            Transformed data.
        rA   N)r1   r   r   rY   rA   r   s           r0   rA   zPipeline.transform  s    D *$// 		 		fdK888 ,D+HHHHMB&*jjll N N"4(Y(MM}T/B/LMM		 		 		 		 		 		 		 		 		 		 		 		 		 		 		 		 		 		s   AA44A8;A8c                 X    t          d |                                 D                       S )Nc              3   >   K   | ]\  }}}t          |d           V  dS )inverse_transformN)rs   )rB   rZ   ry   s      r0   rF   z2Pipeline._can_inverse_transform.<locals>.<genexpr>H  s3      OOwq!Q71122OOOOOOr:   )allrY   r   s    r0   _can_inverse_transformzPipeline._can_inverse_transformG  s'    OO$**,,OOOOOOr:   )r   c                V   t          |           5  t          || d           t          ||          }t          | dfi |}t	          t          |                                                     }|D ]\  }}} |j        |fi ||         j        } |cddd           S # 1 swxY w Y   dS )a  Apply `inverse_transform` for each step in a reverse order.

        All estimators in the pipeline must support `inverse_transform`.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_transformed_features)
            Data samples, where ``n_samples`` is the number of samples and
            ``n_features`` is the number of features. Must fulfill
            input requirements of last step of pipeline's
            ``inverse_transform`` method.

        Xt : array-like of shape (n_samples, n_transformed_features)
            Data samples, where ``n_samples`` is the number of samples and
            ``n_features`` is the number of features. Must fulfill
            input requirements of last step of pipeline's
            ``inverse_transform`` method.

            .. deprecated:: 1.5
                `Xt` was deprecated in 1.5 and will be removed in 1.7. Use `X` instead.

        **params : dict of str -> object
            Parameters requested and accepted by steps. Each step must have
            requested certain metadata for these parameters to be forwarded to
            them.

            .. versionadded:: 1.4
                Only available if `enable_metadata_routing=True`. See
                :ref:`Metadata Routing User Guide <metadata_routing>` for more
                details.

        Returns
        -------
        Xt : ndarray of shape (n_samples, n_features)
            Inverse transformed data, that is, data in the original feature
            space.
        r   N)r1   r   r   r   reversedr   rY   r   )	r7   r   r   r   r   reverse_iterrZ   r   rA   s	            r0   r   zPipeline.inverse_transformJ  s   P *$// 	 	fd,?@@@21b99A ,D2EPPPPM#D$6$677L&2  "4/I/ &t,>  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   BBB"%B"scorec                 J   t          |           5  |}t                      sg|                     d          D ]\  }}}|                    |          }i }	|||	d<    | j        d         d         j        ||fi |	cddd           S t          | dfd|i|}
|}|                     d          D ]\  }}} |j        |fi |
|         j        }  | j        d         d         j        ||fi |
| j        d         d                  j        cddd           S # 1 swxY w Y   dS )	aE  Transform the data, and apply `score` with the final estimator.

        Call `transform` of each transformer in the pipeline. The transformed
        data are finally passed to the final estimator that calls
        `score` method. Only valid if the final estimator implements `score`.

        Parameters
        ----------
        X : iterable
            Data to predict on. Must fulfill input requirements of first step
            of the pipeline.

        y : iterable, default=None
            Targets used for scoring. Must fulfill label requirements for all
            steps of the pipeline.

        sample_weight : array-like, default=None
            If not None, this argument is passed as ``sample_weight`` keyword
            argument to the ``score`` method of the final estimator.

        **params : dict of str -> object
            Parameters requested and accepted by steps. Each step must have
            requested certain metadata for these parameters to be forwarded to
            them.

            .. versionadded:: 1.4
                Only available if `enable_metadata_routing=True`. See
                :ref:`Metadata Routing User Guide <metadata_routing>` for more
                details.

        Returns
        -------
        score : float
            Result of calling `score` on the final estimator.
        Fr   Nsample_weightrk   r
   r   r   )r1   r   rY   rA   rP   r   r   )r7   r   r   r   r   r   rZ   r   rA   score_paramsr   s              r0   r   zPipeline.score  s   L *$// 	 	B#%% F*.****F*F 1 1&AtY",,R00BB! ,4AL1.tz"~a(.r1EEEE	 	 	 	 	 	 	 	 ,g -:>D M B&*jjEj&B&B N N"4(Y(MM}T/B/LMM*4:b>!$*A &tz"~a'89? %	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A+DBDDDc                 2    | j         d         d         j        S )z@The classes labels. Only exist if the last step is a classifier.rk   r
   )rP   classes_r   s    r0   r   zPipeline.classes_  s     z"~a ))r:   c                 P   t                                                      }| j        s|S 	 | j        d         d         K| j        d         d         dk    r4t          | j        d         d                   j        j        |j        _        t          d | j        D                       |j        _        n# t          t          t          f$ r Y nw xY w	 | j        d         d         | j        d         d         dk    rt          | j        d         d                   }|j        |_        |j        j        |j        _        t          |j                  |_        t          |j                  |_        t          |j                  |_        n# t          t          t          f$ r Y nw xY w|S )Nr   r
   rl   c              3   Z   K   | ]&\  }}|d k    t          |          j        j        V  'dS )rl   Nr   
input_tagsr	   r   s      r0   rF   z,Pipeline.__sklearn_tags__.<locals>.<genexpr>  sI       ) )D$=(( )0(((() )r:   rk   )super__sklearn_tags__rP   r   r   pairwiser   r	   r   r   rt   estimator_typetarget_tagsmulti_outputr   classifier_tagsregressor_tagstransformer_tags)r7   tagslast_step_tagsr   s      r0   r   zPipeline.__sklearn_tags__  s   ww''))z 	K	z!}Q+
1a0@M0Q0Q+3JqM!$, ,X ( &) ) )"&*) ) ) & &DO""
 NI6 	 	 	 D	
	z"~a ,B1Bm1S1S!)$*R.*;!<!<&4&C#0>0J0W -'/0N'O'O$&.~/L&M&M#(01P(Q(Q%NI6 	 	 	 D	
 s%   BB3 3CCB7F	 	F#"F#c                     |}|                                  D ]M\  }}}t          |d          s"t          d                    |                    |                    |          }N|S )aj  Get output feature names for transformation.

        Transform input features using the pipeline.

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

        Returns
        -------
        feature_names_out : ndarray of str objects
            Transformed feature names.
        get_feature_names_outzpEstimator {} does not provide get_feature_names_out. Did you mean to call pipeline[:-1].get_feature_names_out()?)rY   rs   r   r   r  )r7   input_featuresfeature_names_outrZ   r   rA   s         r0   r  zPipeline.get_feature_names_out  s     +"&**,, 	S 	SAtY9&=>> $ &,,  
 !* ? ?@Q R R  r:   c                 2    | j         d         d         j        S )z7Number of features seen during first step `fit` method.r   r
   )rP   n_features_in_r   s    r0   r  zPipeline.n_features_in_  s     z!}Q..r:   c                 2    | j         d         d         j        S )z6Names of features seen during first step `fit` method.r   r
   )rP   feature_names_in_r   s    r0   r  zPipeline.feature_names_in_
  s     z!}Q11r:   c                     d}t          | j                  D ]\  }}|dk    r|} n|dS 	 t          |           dS # t          $ r Y dS w xY w)zIndicate whether pipeline has been fit.

        This is done by checking whether the last non-`passthrough` step of the
        pipeline is fitted.

        An empty pipeline is considered fitted.
        Nrl   TF)r   rP   r$   r   )r7   r   rZ   r.   s       r0   __sklearn_is_fitted__zPipeline.__sklearn_is_fitted__  s     	$TZ00 	 	LAyM))%	 * 4	
 I&&&4 	 	 	55	s   = 
A
Ac                     t          | j         \  }}d fd| j        D             }d |D             }t          d|||d          S )Nc                 >    ||dk    r|  dS |  d|j         j         S )Nrl   z: passthroughz: )r   __name__)r   r   s     r0   	_get_namez-Pipeline._sk_visual_block_.<locals>._get_name1  s9    {c]22----66cm4666r:   c                 .    g | ]\  }} ||          S r;   r;   )rB   r   r   r  s      r0   
<listcomp>z.Pipeline._sk_visual_block_.<locals>.<listcomp>7  s)    BBB)$4%%BBBr:   c                 ,    g | ]}t          |          S r;   )str)rB   r   s     r0   r  z.Pipeline._sk_visual_block_.<locals>.<listcomp>8  s    777SC777r:   serialF)rv   name_detailsdash_wrapped)rq   rP   r   )r7   rZ   rw   rv   r  r  s        @r0   _sk_visual_block_zPipeline._sk_visual_block_.  sy    TZ(:	7 	7 	7 CBBBtzBBB77J777%
 
 
 	
r:   c                 H   t          | j        j                  }|                     dd          D ]\  }}}t	                      }t          |d          rB|                    dd                              dd                              dd           n|                    dd                              dd	                              dd                              dd	                              dd                              dd	           |                    d
d	                              d
d	                              dd	                              dd	                              dd	                              d	d	                              dd                              dd	            |j        dd|i||i | j        d         \  }}||dk    r|S t	                      }t          |d          r|                    dd           n,|                    dd                              dd	           |                    dd                              d
d
                              dd                              dd                              dd                              dd                              d	d	                              dd                              dd            |j        dd|i||i |S )aK  Get metadata routing of this object.

        Please check :ref:`User Guide <metadata_routing>` on how the routing
        mechanism works.

        Returns
        -------
        routing : MetadataRouter
            A :class:`~sklearn.utils.metadata_routing.MetadataRouter` encapsulating
            routing information.
        ownerFTr   rn   rm   callercalleer   rA   r   r   r   r   r   r   method_mappingrk   Nrl   r;   )r   r   r  rY   r   rs   addrP   )r7   routerrZ   r   r   r"  
final_name	final_ests           r0   get_metadata_routingzPipeline.get_metadata_routingA  s.     dn&=>>> #jjEdjSS 	G 	GNAtU*__N uo.. "&&eO&LLSSHHSoSFFFF #&&eE&BBSkS::SS>>SSDDSeS<<SkSBBB "")K"HHIk::OK@@/DD/DDK<</8KLLGK888 FJFFnFuFFFF $
2
I	] : :M '9o.. 	ooNNNNeE::>>[ ?    eE::S	)S44SmS<<SS@@S+4GSHHS+4GSHHSKS88S+4GSHHSS000 	
LL.LZ4KLLLr:   T)TT)NNNr?   )NN)6r  
__module____qualname____doc__r   r   rH   r  r   rT   r   __annotations__rW   r\   rc   ri   rz   rY   r   r   propertyr   r   r6   r   r   r   r   r   rm   r   r!   rn   r<   r   r   r   r   r   r   r   rA   r   r   r   r   r   r  r  r  r  r  r'  __classcell__r   s   @r0   r&   r&   |   s        r rl u& $<jj'334;	$ $D    26dE      '+     64 4 4 4&  ,! ! !F' ' ' '"    6 1 1 X1 ) ) X) 	 	 X	W W W$ $ $:K" K" K"^0 0 0 0d \&+  9 9 9	 9v
 
 
 \$%%\&+  : : :	  &%
:x \&&y11229 9 329v \&&}5566\&+  6 6 6	  76
6p \&&77884 4 984l \&&':;;<<- - =<-^ \&&77887 7 9874 \&&':;;<<5 5 =<5n
 
 

 \.!!* * "!*XP P P \())4d 4 4 4 4 *)4l \&&w//009 9 9 109v * * X*& & & & &P! ! ! !4 / / X/
 2 2 X2
  <
 
 
&I I I I I I Ir:   r&   c                    d | D             }t          t                    }t          | |          D ]\  }}||xx         dz  cc<   t          |                                          D ]\  }}|dk    r||= t          t          t          |                               D ]7}||         }||v r)||xx         d||         z  z  cc<   ||xx         dz  cc<   8t          t          ||                     S )zGenerate names for estimators.c                     g | ]?}t          |t                    r|n%t          |          j                                        @S r;   )rG   r  ru   r  lower)rB   r.   s     r0   r  z$_name_estimators.<locals>.<listcomp>  sP         	3//U		T)__5M5S5S5U5U  r:   r
   z-%d)r   intrq   r   r   r   ranger|   )rw   rv   	namecountr   r   kvis           r0   _name_estimatorsr9    s!    #  E C  IU++  	T$1Y__&&''  166!eC
OO,,-- ! !Qx9!HHH	$//HHHdOOOq OOOE:&&'''r:   F)rR   rQ   rS   c                 B    t          t          |          || |          S )aQ	  Construct a :class:`Pipeline` from the given estimators.

    This is a shorthand for the :class:`Pipeline` constructor; it does not
    require, and does not permit, naming the estimators. Instead, their names
    will be set to the lowercase of their types automatically.

    Parameters
    ----------
    *steps : list of Estimator objects
        List of the scikit-learn estimators that are chained together.

    memory : str or object with the joblib.Memory interface, default=None
        Used to cache the fitted transformers of the pipeline. The last step
        will never be cached, even if it is a transformer. By default, no
        caching is performed. If a string is given, it is the path to the
        caching directory. Enabling caching triggers a clone of the transformers
        before fitting. Therefore, the transformer instance given to the
        pipeline cannot be inspected directly. Use the attribute ``named_steps``
        or ``steps`` to inspect estimators within the pipeline. Caching the
        transformers is advantageous when fitting is time consuming.

    transform_input : list of str, default=None
        This enables transforming some input arguments to ``fit`` (other than ``X``)
        to be transformed by the steps of the pipeline up to the step which requires
        them. Requirement is defined via :ref:`metadata routing <metadata_routing>`.
        This can be used to pass a validation set through the pipeline for instance.

        You can only set this if metadata routing is enabled, which you
        can enable using ``sklearn.set_config(enable_metadata_routing=True)``.

        .. versionadded:: 1.6

    verbose : bool, default=False
        If True, the time elapsed while fitting each step will be printed as it
        is completed.

    Returns
    -------
    p : Pipeline
        Returns a scikit-learn :class:`Pipeline` object.

    See Also
    --------
    Pipeline : Class for creating a pipeline of transforms with a final
        estimator.

    Examples
    --------
    >>> from sklearn.naive_bayes import GaussianNB
    >>> from sklearn.preprocessing import StandardScaler
    >>> from sklearn.pipeline import make_pipeline
    >>> make_pipeline(StandardScaler(), GaussianNB(priors=None))
    Pipeline(steps=[('standardscaler', StandardScaler()),
                    ('gaussiannb', GaussianNB())])
    rU   )r&   r9  )rR   rQ   rS   rP   s       r0   r(   r(     s0    p '	   r:   c                 :     | j         |fi |j         }||S ||z  S )a;  Call transform and apply weight to output.

    Parameters
    ----------
    transformer : estimator
        Estimator to be used for transformation.

    X : {array-like, sparse matrix} of shape (n_samples, n_features)
        Input data to be transformed.

    y : ndarray of shape (n_samples,)
        Ignored.

    weight : float
        Weight to be applied to the output of the transformation.

    params : dict
        Parameters to be passed to the transformer's ``transform`` method.

        This should be of the form ``process_routing()["step_name"]``.
    r@   )r   r   r   r   r   ress         r0   _transform_oner=    s5    ,  +

6
6V%5
6
6C~
<r:    c           
      b   |pi }t          ||          5  t          | d          r$ | j        ||fi |                    di           }nC  | j        ||fi |                    di           j        |fi |                    di           }ddd           n# 1 swxY w Y   ||| fS ||z  | fS )a  
    Fits ``transformer`` to ``X`` and ``y``. The transformed result is returned
    with the fitted transformer. If ``weight`` is not ``None``, the result will
    be multiplied by ``weight``.

    ``params`` needs to be of the form ``process_routing()["step_name"]``.
    rn   rm   rA   N)r   rs   rn   r   rm   rA   )r   r   r   r   r   r   r   r<  s           r0   r   r     s(    \rF	_g	6	6  ;00 	+++AqTTFJJPR4S4STTCCJ/+/!Q@@&**UB*?*?@@J ZZR00 C	               ~K<$$s   A8BB Bc                     t          ||          5   | j        ||fi |d         cddd           S # 1 swxY w Y   dS )z2
    Fits ``transformer`` to ``X`` and ``y``.
    rm   N)r   rm   )r   r   r   r   r   r   r   s          r0   _fit_onerA    s     
_g	6	6 6 6{q!55ve}556 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s   377c                        e Zd ZdZddddddZdd fd
Zed	             Zdd
Zd Z	d Z
d Zd Zd dZd Zd dZd dZd Zd Zd Zd Zd Zed             Zed             Zd Zd Zd Zd Z fdZ xZS )!r'   ap  Concatenates results of multiple transformer objects.

    This estimator applies a list of transformer objects in parallel to the
    input data, then concatenates the results. This is useful to combine
    several feature extraction mechanisms into a single transformer.

    Parameters of the transformers may be set using its name and the parameter
    name separated by a '__'. A transformer may be replaced entirely by
    setting the parameter with its name to another transformer, removed by
    setting to 'drop' or disabled by setting to 'passthrough' (features are
    passed without transformation).

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

    .. versionadded:: 0.13

    Parameters
    ----------
    transformer_list : list of (str, transformer) tuples
        List of transformer objects to be applied to the data. The first
        half of each tuple is the name of the transformer. The transformer can
        be 'drop' for it to be ignored or can be 'passthrough' for features to
        be passed unchanged.

        .. versionadded:: 1.1
           Added the option `"passthrough"`.

        .. versionchanged:: 0.22
           Deprecated `None` as a transformer in favor of 'drop'.

    n_jobs : int, default=None
        Number of jobs to run in parallel.
        ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
        ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
        for more details.

        .. versionchanged:: v0.20
           `n_jobs` default changed from 1 to None

    transformer_weights : dict, default=None
        Multiplicative weights for features per transformer.
        Keys are transformer names, values the weights.
        Raises ValueError if key not present in ``transformer_list``.

    verbose : bool, default=False
        If True, the time elapsed while fitting each transformer will be
        printed as it is completed.

    verbose_feature_names_out : bool, default=True
        If True, :meth:`get_feature_names_out` will prefix all feature names
        with the name of the transformer that generated that feature.
        If False, :meth:`get_feature_names_out` will not prefix any feature
        names and will error if feature names are not unique.

        .. versionadded:: 1.5

    Attributes
    ----------
    named_transformers : :class:`~sklearn.utils.Bunch`
        Dictionary-like object, with the following attributes.
        Read-only attribute to access any transformer parameter by user
        given name. Keys are transformer names and values are
        transformer parameters.

        .. versionadded:: 1.2

    n_features_in_ : int
        Number of features seen during :term:`fit`. Only defined if the
        underlying first transformer in `transformer_list` exposes such an
        attribute when fit.

        .. versionadded:: 0.24

    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.

        .. versionadded:: 1.3

    See Also
    --------
    make_union : Convenience function for simplified feature union
        construction.

    Examples
    --------
    >>> from sklearn.pipeline import FeatureUnion
    >>> from sklearn.decomposition import PCA, TruncatedSVD
    >>> union = FeatureUnion([("pca", PCA(n_components=1)),
    ...                       ("svd", TruncatedSVD(n_components=2))])
    >>> X = [[0., 1., 3], [2., 2., 5]]
    >>> union.fit_transform(X)
    array([[-1.5       ,  3.0..., -0.8...],
           [ 1.5       ,  5.7...,  0.4...]])
    >>> # An estimator's parameter can be set using '__' syntax
    >>> union.set_params(svd__n_components=1).fit_transform(X)
    array([[-1.5       ,  3.0...],
           [ 1.5       ,  5.7...]])

    For a more detailed example of usage, see
    :ref:`sphx_glr_auto_examples_compose_plot_feature_union.py`.
    NFT)n_jobstransformer_weightsrS   verbose_feature_names_outc                L    || _         || _        || _        || _        || _        d S r?   )transformer_listrC  rD  rS   rE  )r7   rG  rC  rD  rS   rE  s         r0   rW   zFeatureUnion.__init__  s0     !1#6 )B&&&r:   r@   c                    t                                          |           |                                 D ]\  }}}t          ||           | S )a  Set the output container when `"transform"` and `"fit_transform"` are called.

        `set_output` will set the output of all estimators in `transformer_list`.

        Parameters
        ----------
        transform : {"default", "pandas", "polars"}, default=None
            Configure output of `transform` and `fit_transform`.

            - `"default"`: Default output format of a transformer
            - `"pandas"`: DataFrame output
            - `"polars"`: Polars output
            - `None`: Transform configuration is unchanged

        Returns
        -------
        self : estimator instance
            Estimator instance.
        r@   )r   r\   rY   r   )r7   rA   rZ   r[   r   s       r0   r\   zFeatureUnion.set_output  sX    ( 	Y///**,, 	8 	8JAtQTY77777r:   c                 >    t          di t          | j                  S )Nr;   )r   r   rG  r   s    r0   named_transformerszFeatureUnion.named_transformers  s#     33tD122333r:   c                 0    |                      d|          S )a  Get parameters for this estimator.

        Returns the parameters given in the constructor as well as the
        estimators contained within the `transformer_list` of the
        `FeatureUnion`.

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

        Returns
        -------
        params : mapping of string to any
            Parameter names mapped to their values.
        rG  r^   r`   rb   s     r0   rc   zFeatureUnion.get_params  s    $  2>>>r:   c                       | j         di | | S )ab  Set the parameters of this estimator.

        Valid parameter keys can be listed with ``get_params()``. Note that
        you can directly set the parameters of the estimators contained in
        `transformer_list`.

        Parameters
        ----------
        **kwargs : dict
            Parameters of this estimator or parameters of estimators contained
            in `transform_list`. Parameters of the transformers may be set
            using its name and the parameter name separated by a '__'.

        Returns
        -------
        self : object
            FeatureUnion class instance.
        rG  )rG  re   rg   s     r0   ri   zFeatureUnion.set_params  s"    & 	66v666r:   c           	         t          | j         \  }}|                     |           |D ]Z}|dv rt          |d          st          |d          rt          |d          s#t	          d|dt          |          d          [d S )N)droprl   rm   rn   rA   z4All estimators should implement fit and transform. 'ro   rp   )rq   rG  rr   rs   rt   ru   )r7   rv   rx   ry   s       r0   _validate_transformersz#FeatureUnion._validate_transformers  s    !4#89| 	U###  		 		A+++Au%% O)D)D W;N N   i;<11d1ggggG  		 		r:   c                     | j         sd S t          d | j        D                       }| j         D ]}||vrt          d| d          d S )Nc              3       K   | ]	\  }}|V  
d S r?   r;   )rB   r   rZ   s      r0   rF   z=FeatureUnion._validate_transformer_weights.<locals>.<genexpr>  s&      JJqJJJJJJr:   z"Attempting to weight transformer "z-", but it is not present in transformer_list.)rD  setrG  r   )r7   transformer_namesr   s      r0   _validate_transformer_weightsz*FeatureUnion._validate_transformer_weights  s    ' 	FJJD4IJJJJJ, 	 	D,,, A A A A   -	 	r:   c              #      K   | j         pi j        }| j        D ]2\  }}|dk    r|dk    rt          d          }|| ||          fV  3dS )zg
        Generate (name, trans, weight) tuples excluding None and
        'drop' transformers.
        rN  rl   z
one-to-one)r	  N)rD  r   rG  r   )r7   
get_weightr   r   s       r0   rY   zFeatureUnion._iter  s       .4"9
0 	2 	2KD%%%+lKKK

4 0 011111	2 	2r:   c           	      H   g }|                                  D ]w\  }}}t          |d          s5t          dt          |          dt	          |          j        d          |                    |          }|                    ||f           x|                     |          S )a4  Get output feature names for transformation.

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

        Returns
        -------
        feature_names_out : ndarray of str objects
            Transformed feature names.
        r  zTransformer z (type z)) does not provide get_feature_names_out.)	rY   rs   r   r  ru   r  r  append!_add_prefix_for_feature_names_out)r7   r  "transformer_with_feature_names_outr   r   rZ   r	  s          r0   r  z"FeatureUnion.get_feature_names_out  s     .0*"jjll 	Q 	QND%5"9:: $n4yyyy$u++"6"6"68   !& ; ;N K K.55t=N6OPPPP55.
 
 	
r:   c                 H   | j         rFt          t          j        d |D                                 }t	          j        |t                    S t          t          j        d |D                                 }d |                    d          D             }|	                                 |rXt          |          dk    r#t          |dd                   dd         d	z   }nt          |          }t          d
| d          t	          j        d |D                       S )a  Add prefix for feature names out that includes the transformer names.

        Parameters
        ----------
        transformer_with_feature_names_out : list of tuples of (str, array-like of str)
            The tuple consistent of the transformer's name and its feature names out.

        Returns
        -------
        feature_names_out : ndarray of shape (n_features,), dtype=str
            Transformed feature names.
        c              3   :   K   | ]\  }fd |D             V  dS )c              3   &   K   | ]} d | V  dS )r   Nr;   )rB   r8  r   s     r0   rF   zKFeatureUnion._add_prefix_for_feature_names_out.<locals>.<genexpr>.<genexpr>;  s-      ??^^^^??????r:   Nr;   )rB   r	  r   s     @r0   rF   zAFeatureUnion._add_prefix_for_feature_names_out.<locals>.<genexpr>:  sR       $ $// @???->???$ $ $ $ $ $r:   )dtypec              3       K   | ]	\  }}|V  
d S r?   r;   )rB   rZ   ss      r0   rF   zAFeatureUnion._add_prefix_for_feature_names_out.<locals>.<genexpr>D  s&      QQdaQQQQQQr:   c                 $    g | ]\  }}|d k    |S )r
   r;   )rB   r   counts      r0   r  zBFeatureUnion._add_prefix_for_feature_names_out.<locals>.<listcomp>F  s)     
 
 
 T5%RS))D)))r:      N   rk   z, ...]zOutput feature names: z[ are not unique. Please set verbose_feature_names_out=True to add prefixes to feature namesc                     g | ]\  }}|S r;   r;   )rB   rZ   r   s      r0   r  zBFeatureUnion._add_prefix_for_feature_names_out.<locals>.<listcomp>W  s    DDDgaTDDDr:   )rE  r   r   from_iterablenpasarrayobjectr   most_commonsortr|   r  r   concatenate)r7   rZ  rv   feature_names_counttop_6_overlap
names_reprs         r0   rY  z.FeatureUnion._add_prefix_for_feature_names_out*  su    ) 	3# $ $3U$ $ $   E :e62222 &QQ.PQQQQQ
 

 
$7$C$CA$F$F
 
 
 	 
	=!!Q&& !rr!233CRC88C

 //
R R R R  
 ~DD!CDDD
 
 	
r:   c                 "   t                      rt          | dfi |}n;t                      }| j        D ]%\  }}t          i           ||<   |||         _        &|                     ||t          |          }|s| S |                     |           | S )a  Fit all transformers using X.

        Parameters
        ----------
        X : iterable or array-like, depending on transformers
            Input data, used to fit transformers.

        y : array-like of shape (n_samples, n_outputs), default=None
            Targets for supervised learning.

        **fit_params : dict, default=None
            - If `enable_metadata_routing=False` (default):
              Parameters directly passed to the `fit` methods of the
              sub-transformers.

            - If `enable_metadata_routing=True`:
              Parameters safely routed to the `fit` methods of the
              sub-transformers. See :ref:`Metadata Routing User Guide
              <metadata_routing>` for more details.

            .. versionchanged:: 1.5
                `**fit_params` can be routed via metadata routing API.

        Returns
        -------
        self : object
            FeatureUnion class instance.
        rm   rm   )r   r   r   rG  rm   _parallel_funcrA  _update_transformer_list)r7   r   r   
fit_paramsr   r   rZ   rx   s           r0   rm   zFeatureUnion.fitZ  s    :  	5+D%FF:FFMM "GGM0 5 5a&+mmmd#*4d#''**1a=II 	K%%l333r:   c                 &   t                      rt          | dfi |}nt                      }| j        D ]i\  }}t	          |d          r!t          i           ||<   |||         _        6t          i           ||<   t          i           ||<   |||         _        j|                     ||t          |          }|s!t          j
        |j        d         df          S t          | \  }}	|                     |	           |                     |          S )a  Fit all transformers, transform the data and concatenate results.

        Parameters
        ----------
        X : iterable or array-like, depending on transformers
            Input data to be transformed.

        y : array-like of shape (n_samples, n_outputs), default=None
            Targets for supervised learning.

        **params : dict, default=None
            - If `enable_metadata_routing=False` (default):
              Parameters directly passed to the `fit` methods of the
              sub-transformers.

            - If `enable_metadata_routing=True`:
              Parameters safely routed to the `fit` methods of the
              sub-transformers. See :ref:`Metadata Routing User Guide
              <metadata_routing>` for more details.

            .. versionchanged:: 1.5
                `**params` can now be routed via metadata routing API.

        Returns
        -------
        X_t : array-like or sparse matrix of                 shape (n_samples, sum_n_components)
            The `hstack` of results of transformers. `sum_n_components` is the
            sum of `n_components` (output dimension) over transformers.
        rn   )rn   rq  r@   r   )r   r   r   rG  rs   rn   rm   rr  r   rg  zerosshaperq   rs  _hstack)
r7   r   r   r   r   r   objresultsXsrx   s
             r0   rn   zFeatureUnion.fit_transform  s*   >  	5+D/LLVLLMM "GGM!2 5 5	c300 5*/b*A*A*AM$'8>M$'55*/B---M$'*/"*=*=*=M$'.4M$'++%%a,>NN 	-8QWQZO,,,=L%%l333||Br:   c                 $    | j         sd S d|||fz  S )Nr   )rS   )r7   r   r   totals       r0   r   zFeatureUnion._log_message  s#    | 	4.#ud1CCCr:   c                 L    t           j                   _                                                                            t                                                      t           j                   fdt          d          D                       S )z Runs func in parallel on X and yrC  c              3      K   | ]R\  }\  }}} t                    |
|d                     ||t          	                    |                   V  SdS )r'   )r   r   r   N)r#   r   r|   )rB   r   r   r   r   r   funcr   r7   rx   r   s        r0   rF   z.FeatureUnion._parallel_func.<locals>.<genexpr>  s       ,
 ,
 10dK GDMM .))$S5F5FGG$T*  ,
 ,
 ,
 ,
 ,
 ,
r:   r
   )r   rG  rO  rT  rY   r"   rC  r}   )r7   r   r   r  r   rx   s   `````@r0   rr  zFeatureUnion._parallel_func  s     $T%: ; ;##%%%**,,,DJJLL))+xt{+++ ,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
 5>lA4N4N,
 ,
 ,
 
 
 	
r:   c                    t          || d           t                      rt          | dfi |n.t                      | j        D ]\  }}t          i           |<    t          | j                  fd|                                 D                       }|s!t          j	        j
        d         df          S |                     |          S )a  Transform X separately by each transformer, concatenate results.

        Parameters
        ----------
        X : iterable or array-like, depending on transformers
            Input data to be transformed.

        **params : dict, default=None

            Parameters routed to the `transform` method of the sub-transformers via the
            metadata routing API. See :ref:`Metadata Routing User Guide
            <metadata_routing>` for more details.

            .. versionadded:: 1.5

        Returns
        -------
        X_t : array-like or sparse matrix of shape (n_samples, sum_n_components)
            The `hstack` of results of transformers. `sum_n_components` is the
            sum of `n_components` (output dimension) over transformers.
        rA   r@   r  c           	   3   p   K   | ]0\  }}} t          t                    |d ||                   V  1d S )N)r   )r#   r=  )rB   r   r   r   r   r   s       r0   rF   z)FeatureUnion.transform.<locals>.<genexpr>  s`       *
 *
#eV $GN##E1dF=QUCVWWW*
 *
 *
 *
 *
 *
r:   r   )r   r   r   r   rG  r"   rC  rY   rg  rv  rw  rx  )r7   r   r   r   rZ   r{  r   s    `    @r0   rA   zFeatureUnion.transform  s    , 	&$444 	:+D+HHHHMM "GGM0 : :a&+b&9&9&9d##)XT[))) *
 *
 *
 *
 *
'+zz||*
 *
 *
 
 
  	-8QWQZO,,,||Br:   c                 4   t          d|           r0t          fd|D                       r                    |          S t          d |D                       r't	          j        |                                          }nt          j        |          }|S )NrA   c              3   B   K   | ]}                     |          V  d S r?   )is_supported_container)rB   r   adapters     r0   rF   z'FeatureUnion._hstack.<locals>.<genexpr>  s1      II799!<<IIIIIIr:   c              3   >   K   | ]}t          j        |          V  d S r?   )r	   issparse)rB   fs     r0   rF   z'FeatureUnion._hstack.<locals>.<genexpr>  s,      ..avq!!......r:   )r   r   hstackanyr	   tocsrrg  )r7   r{  r  s     @r0   rx  zFeatureUnion._hstack  s    (d;; 	&sIIIIbIIIII 	&>>"%%%..2..... 	r""((**BB2B	r:   c                 `    t                    fd| j        D             | j        d d <   d S )Nc                 H    g | ]\  }}||d k    r|nt                    fS )rN  )next)rB   r   oldrx   s      r0   r  z9FeatureUnion._update_transformer_list.<locals>.<listcomp>  sF     $
 $
 $
c #--33T,-?-?@$
 $
 $
r:   )iterrG  )r7   rx   s    `r0   rs  z%FeatureUnion._update_transformer_list  sM    L))$
 $
 $
 $
!2$
 $
 $
aaa   r:   c                 2    | j         d         d         j        S )z+Number of features seen during :term:`fit`.r   r
   )rG  r  r   s    r0   r  zFeatureUnion.n_features_in_  s    
 $Q'*99r:   c                 2    | j         d         d         j        S )z*Names of features seen during :term:`fit`.r   r
   )rG  r  r   s    r0   r  zFeatureUnion.feature_names_in_  s     $Q'*<<r:   c                 Z    |                                  D ]\  }}}t          |           dS r4   )rY   r$   )r7   rZ   r   s      r0   r  z"FeatureUnion.__sklearn_is_fitted__"  s6    !% 	) 	)A{AK((((tr:   c                 H    t          | j         \  }}t          d||          S )Nparallel)rv   )rq   rG  r   )r7   rv   rx   s      r0   r  zFeatureUnion._sk_visual_block_(  s)    !4#89|JEBBBBr:   c                 d    t          |t                    st          d          | j        |         S )zReturn transformer with name.zOnly string keys are supported)rG   r  KeyErrorrJ  )r7   r   s     r0   r   zFeatureUnion.__getitem__,  s1    $$$ 	=;<<<&t,,r:   c           
      d   t          | j        j                  }| j        D ]\  }} |j        di ||idt                                          dd                              dd                              dd                              dd                              dd          i |S )aj  Get metadata routing of this object.

        Please check :ref:`User Guide <metadata_routing>` on how the routing
        mechanism works.

        .. versionadded:: 1.5

        Returns
        -------
        routing : MetadataRouter
            A :class:`~sklearn.utils.metadata_routing.MetadataRouter` encapsulating
            routing information.
        r  r"  rm   r  rn   rA   r;   )r   r   r  rG  r#  r   )r7   r$  r   r   s       r0   r'  z!FeatureUnion.get_metadata_routing2  s      dn&=>>>!%!6 		 		D+FJ  % ,E%00OODDOE::OK@@K<<     r:   c                     t                                                      }	 t          d | j        D                       |j        _        n# t          $ r Y nw xY w|S )Nc              3   V   K   | ]$\  }}|d v	t          |          j        j        V  %dS )>   rN  rl   Nr   )rB   r   r   s      r0   rF   z0FeatureUnion.__sklearn_tags__.<locals>.<genexpr>R  sJ       ) )D% 777 *17777) )r:   )r   r   r   rG  r   r	   	Exception)r7   r  r   s     r0   r   zFeatureUnion.__sklearn_tags__O  s~    ww''))
	%( ) )#'#8) ) ) & &DO""
  	 	 	 D		
 s   (A 
AAr(  r?   )r  r)  r*  r+  rW   r\   r-  rJ  rc   ri   rO  rT  rY   r  rY  rm   rn   r   rr  rA   rx  rs  r  r  r  r  r   r'  r   r.  r/  s   @r0   r'   r'   "  s       e eV  "&C C C C C '+       2 4 4 X4? ? ? ?(  ,  $
 
 
2 2 2
 
 
 
8.
 .
 .
`- - - -^5  5  5  5 nD D D

 
 
((  (  ( T	 	 	
 
 
 : : X: = = X=
  C C C- - -  :        r:   r'   rC  rS   c                 @    t          t          |          | |          S )a  Construct a :class:`FeatureUnion` from the given transformers.

    This is a shorthand for the :class:`FeatureUnion` constructor; it does not
    require, and does not permit, naming the transformers. Instead, they will
    be given names automatically based on their types. It also does not allow
    weighting.

    Parameters
    ----------
    *transformers : list of estimators
        One or more estimators.

    n_jobs : int, default=None
        Number of jobs to run in parallel.
        ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
        ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
        for more details.

        .. versionchanged:: v0.20
           `n_jobs` default changed from 1 to None.

    verbose : bool, default=False
        If True, the time elapsed while fitting each transformer will be
        printed as it is completed.

    Returns
    -------
    f : FeatureUnion
        A :class:`FeatureUnion` object for concatenating the results of multiple
        transformer objects.

    See Also
    --------
    FeatureUnion : Class for concatenating the results of multiple transformer
        objects.

    Examples
    --------
    >>> from sklearn.decomposition import PCA, TruncatedSVD
    >>> from sklearn.pipeline import make_union
    >>> make_union(PCA(), TruncatedSVD())
     FeatureUnion(transformer_list=[('pca', PCA()),
                                   ('truncatedsvd', TruncatedSVD())])
    r  )r'   r9  )rC  rS   rx   s      r0   r)   r)   _  s#    Z (66vwWWWWr:   r?   )r>  NN)Fr+  r+   collectionsr   r   
contextlibr   copyr   	itertoolsr   r   numpyrg  scipyr	   baser   r   r   
exceptionsr   preprocessingr   utilsr   utils._estimator_html_reprr   utils._metadata_requestsr   utils._param_validationr   r   utils._set_outputr   r   utils._tagsr   utils._user_interfacer   utils.deprecationr   utils.metadata_routingr   r   r   r   r   r   utils.metaestimatorsr    r!   utils.parallelr"   r#   utils.validationr$   r%   __all__r1   r<   rL   r&   r9  r(   r=  r   rA  r'   r)   r;   r:   r0   <module>r     si   W W
  , , , , , , , , % % % % % %       # # # # # # # #           7 7 7 7 7 7 7 7 7 7 & & & & & & . . . . . .       4 4 4 4 4 4 - - - - - - 7 7 7 7 7 7 7 7        " ! ! ! ! ! 6 6 6 6 6 6 A A A A A A                A @ @ @ @ @ @ @ - - - - - - - - ; ; ; ; ; ; ; ;
E
E
E 
 
 
4
 
 
% % %PN N N N N N N Nb(( ( (0 "&tU = = = = =@   < IM% % % %06 6 6 6z z z z z#%5 z z zz &*5 -X -X -X -X -X -X -Xr:   