ó
    ê-iz	  ã                   óN   • S r SSKrSSKJr  SSKJr  SSKJrJ	r	   " S S\5      r
g)	zY
Feature agglomeration. Base classes and functions for performing feature
agglomeration.
é    N)Úissparseé   )ÚTransformerMixin)Úcheck_is_fittedÚvalidate_datac                   ó$   • \ rS rSrSrS rS rSrg)ÚAgglomerationTransformé   z@
A class for feature agglomeration via the transform interface.
c                 ó–  • [        U 5        [        XSS9nU R                  [        R                  :X  a™  [        U5      (       d‰  [        R                  " U R                  5      nUR                  S   n[        R                  " [        U5       Vs/ s H-  n[        R                  " U R                  XSS24   5      U-  PM/     sn5      nU$ [        R                  " U R                  5       Vs/ s H'  nU R                  USS2U R                  U:H  4   SS9PM)     nn[        R                  " U5      R                  nU$ s  snf s  snf )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          ÚY/var/www/html/venv/lib/python3.13/site-packages/sklearn/cluster/_feature_agglomeration.pyÚ	transformÚ AgglomerationTransform.transform   s  € ô  	˜Ôä˜$¨Ñ/ˆØ×Ñ¤§¡Ó'´¸·±Ü—;’;˜tŸ|™|Ó,ˆDØŸ™ ™
ˆIä—’ÜDIÈ)ÔDTÓUÒDT¸q”—’˜TŸ\™\¨1²¨T©7Ó3°dÔ:ÑDTÑUóˆBð ˆ	ô Ÿš 4§<¡<Ô0óâ0Að ×!Ñ! !¢A t§|¡|°qÑ'8Ð$8Ñ"9ÀÐ!ÓBÙ0ð ð ô —’˜"“—‘ˆBØˆ	ùò Vùòs   Â4EÃ/.Ec                 óh   • [        U 5        [        R                  " U R                  SS9u  p#USU4   $ )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.

Returns
-------
X_original : ndarray of shape (n_samples, n_features) or (n_features,)
    A vector of size `n_samples` with the values of `X` assigned to
    each of the cluster of samples.
T)Úreturn_inverse.)r   r   r   r   )r   r   ÚunilÚinverses       r    Úinverse_transformÚ(AgglomerationTransform.inverse_transform:   s0   € ô 	˜ÔäŸ	š	 $§,¡,¸tÑD‰ˆØg‰Ðó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   r'   Ú__static_attributes__r*   r)   r    r	   r	      s   † ñò õDr)   r	   )r/   Únumpyr   Úscipy.sparser   Úbaser   Úutils.validationr   r   r	   r*   r)   r    Ú<module>r5      s%   ðñó Ý !å #ß =ô9Ð-õ 9r)   