Ë
    ÷Q(h>  ã                   óf   — d 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mZ  G d	„ d
e«      Zy)zY
Feature agglomeration. Base classes and functions for performing feature
agglomeration.
é    N)Úissparseé   )ÚTransformerMixin)Úmetadata_routing)Ú"_deprecate_Xt_in_inverse_transform)Úcheck_is_fittedÚvalidate_datac                   ó@   — e Zd ZdZdej
                  iZd„ Zdddœd„Zy)ÚAgglomerationTransformzH
    A class for feature agglomeration via the transform interface.
    ÚXtc                 ó„  — t        | «       t        | |d¬«      }| j                  t        j                  k(  r�t        |«      s„t        j                  | j                  «      }|j                  d   }t        j                  t        |«      D �cg c],  }t        j                  | j                  ||dd…f   «      |z  ‘Œ. c}«      }|S t        j                  | j                  «      D �cg c])  }| j                  |dd…| j                  |k(  f   d¬«      ‘Œ+ }}t        j                  |«      j                  }|S c c}w c c}w )aì  
        Transform a new matrix using the built clustering.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features) or                 (n_samples, n_samples)
            A M by N array of M observations in N dimensions or a length
            M array of M one-dimensional observations.

        Returns
        -------
        Y : ndarray of shape (n_samples, n_clusters) or (n_clusters,)
            The pooled values for each feature cluster.
        F)Úresetr   Né   )Úaxis)r   r	   Úpooling_funcÚnpÚmeanr   ÚbincountÚlabels_ÚshapeÚarrayÚrangeÚuniqueÚT)ÚselfÚXÚsizeÚ	n_samplesÚiÚnXÚls          úd/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sklearn/cluster/_feature_agglomeration.pyÚ	transformz AgglomerationTransform.transform    s  € ô  	˜Ôä˜$ ¨Ô/ˆØ×Ñ¤§¡Ò'´¸´Ü—;‘;˜tŸ|™|Ó,ˆDØŸ™ ™
ˆIä—‘ÜDIÈ)ÓDTÖU¸q”—‘˜TŸ\™\¨1¨Q²¨T©7Ó3°dÓ:ÒUóˆBð ˆ	ô Ÿ™ 4§<¡<Ó0öàð ×!Ñ! !¢A t§|¡|°qÑ'8Ð$8Ñ"9ÀÐ!ÕBðˆBð ô —‘˜"“—‘ˆBØˆ	ùò Vùòs   Â1D8Ã'.D=N)r   c                ó†   — t        ||«      }t        | «       t        j                  | j                  d¬«      \  }}|d|f   S )að  
        Inverse the transformation and return a vector of size `n_features`.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_clusters) or (n_clusters,)
            The values to be assigned to each cluster of samples.

        Xt : array-like of shape (n_samples, n_clusters) or (n_clusters,)
            The values to be assigned to each cluster of samples.

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

        Returns
        -------
        X : ndarray of shape (n_samples, n_features) or (n_features,)
            A vector of size `n_samples` with the values of `Xred` assigned to
            each of the cluster of samples.
        T)Úreturn_inverse.)r   r   r   r   r   )r   r   r   ÚunilÚinverses        r"   Úinverse_transformz(AgglomerationTransform.inverse_transformB   s>   € ô* /¨q°"Ó5ˆä˜ÔäŸ	™	 $§,¡,¸tÔD‰ˆˆgØ��g�‰Ðó    )N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚUNUSEDÚ<_AgglomerationTransform__metadata_request__inverse_transformr#   r(   © r)   r"   r   r      s-   „ ñð .2Ð3C×3JÑ3JÐ,KÐ)ò ðD¨dõ r)   r   )r-   Únumpyr   Úscipy.sparser   Úbaser   Úutilsr   Úutils.deprecationr   Úutils.validationr   r	   r   r0   r)   r"   ú<module>r7      s-   ðñó Ý !å #Ý $Ý Bß =ôFÐ-õ Fr)   