Ë
    ®Ó^j"Z  ã                   óˆ  — U d Z ddlZddlZddlZddlZddlmZmZ ddlm	Z
 ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlZddlmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z( erddl)Z*ddl+Z, G d	„ d
e«      Z- G d„ de«      Z. edee/e0f   e1ed   eee/df      ee/df   edde-f   dœ«      Z2 edee/e0f   e1ed   eee/df      ee/df   edde-f   e/dœ«      Z3 ede2e2dœ«      Z4 ede3e3dœ«      Z5de!de0fd„Z6de.de3fd„Z7de.de8fd„Z9dKde2de0de$fd„Z:dZ;dee e/f   d ee/df   d!eejx                     d"e0de2f
d#„Z=deded$   fd%„Z> G d&„ d'e«      Z?dedee?   fd(„Z@e
deeeejx                     f   fd)„«       ZAed*e/d+e1d,e/d-dde2f
d.„«       ZBed*e/d+e1d,e/d-e/de3f
d/„«       ZBd*e/d+e1d,e/d-ee/   dee2e3f   f
d0„ZBd1d2dee4ef   fd3„ZCd4d5de2fd6„ZDd1d2d7ee-e.d8f   dee4e2ef   fd9„ZEde!d!ee#   deejŒ                  ee#   f   fd:„ZGd4e$de0fd;„ZHdejŒ                  de2fd<„ZId1e?d7d=deee4e2f   e2ef   fd>„ZJdejŒ                  de8fd?„ZKde.d@e1ddfdA„ZLd1e?dee5ef   fdB„ZMd1e?d7d=deee3e5f   e2ef   fdC„ZN G dD„ dE«      ZOdFeee"eOf      deee"   eeO   f   fdG„ZPeeee2e3f   eee2e3e4e5f   ee2e3f   f   f      ZQeeRdH<    G dI„ dJe«      ZSy)Lz+Helpers for interfacing array like objects.é    N)ÚABCÚabstractmethod)Úcache)ÚTYPE_CHECKINGÚAnyÚCallableÚDictÚListÚLiteralÚOptionalÚProtocolÚTupleÚTypeÚ	TypeAliasÚ	TypedDictÚ	TypeGuardÚUnionÚcastÚoverloadé   )ÚArrowCatListÚCNumericPtrÚDataTypeÚFeatureTypesÚ
NumpyDTypeÚNumpyOrCupy)Úimport_cupyÚimport_pyarrowÚlazy_isinstancec                   ó   — e Zd Zedd„«       Zy)Ú_ArrayLikeArgc                  ó   — y ©N© ©Úselfs    ú^/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/xgboost/_data_utils.pyÚ__array_interface__z!_ArrayLikeArg.__array_interface__/   s   € Ø14ó    N)ÚreturnÚArrayInf)Ú__name__Ú
__module__Ú__qualname__Úpropertyr(   r$   r)   r'   r!   r!   .   s   „ ØÚ4ó Ù4r)   r!   c                   ó   — e Zd Zedd„«       Zy)Ú_CudaArrayLikeArgc                  ó   — y r#   r$   r%   s    r'   Ú__cuda_array_interface__z*_CudaArrayLikeArg.__cuda_array_interface__4   s   € Ø:=r)   N)r*   ÚCudaArrayInf)r,   r-   r.   r/   r3   r$   r)   r'   r1   r1   3   s   „ ØÚ=ó Ù=r)   r1   r+   é   .©ÚdataÚtypestrÚversionÚstridesÚshapeÚmaskr4   ©r7   r8   r9   r:   r;   r<   ÚstreamÚStringArray©ÚoffsetsÚvaluesÚCudaStringArrayr7   r*   c                 óz   — t        | d«      xr. t        | j                  d«      xr | j                  j                  S )z)Whether the numpy array has object dtype.ÚdtypeÚ	hasobject)ÚhasattrrE   rF   ©r7   s    r'   Úarray_hasobjectrI   W   s8   € ô 	��gÓò 	!Ü�D—J‘J Ó,ò	!à�J‰J× Ñ ðr)   c                 ó  — t        | «      rt        d«      ‚| j                  }d|v r_|d   �Z|d   j                  }|d   }|d   d   }|d   dv r2|d	d d
k(  r*|r(t        |«      }d|d<   |f|d<   |j	                  dd«       ||d<   |S )z6Returns a dictionary storing the CUDA array interface.ú<Input data contains `object` dtype.  Expecting numeric data.r<   Nr8   r;   r   r   )ÚuÚiÚté   Ú1z|t1r:   )rI   Ú
ValueErrorr3   ÚdictÚpop)r7   ÚainfÚ	mask_ainfr8   Ú	n_sampless        r'   Úcuda_array_interface_dictrW   `   s°   € ä�tÔÜÐWÓXÐXØ×(Ñ(€DØ��~˜$˜v™,Ð2Ø˜‘L×9Ñ9ˆ	ð ˜IÑ&ˆØ˜‘M !Ñ$ˆ	Ø�1‰:˜Ñ(¨W°Q°R¨[¸CÒ-?ÁIÜ˜Y›ˆIØ#(ˆI�iÑ Ø"+ ˆI�gÑØ�M‰M˜) TÔ*Ø ˆˆV‰Ø€Kr)   c                 óZ   — t        | «      }t        t        j                  |«      d«      }|S )zMake cuda array interface str.úutf-8)rW   ÚbytesÚjsonÚdumps©r7   Ú	interfaceÚinterface_strs      r'   Úcuda_array_interfacer`   t   s'   € ä)¨$Ó/€IÜœ$Ÿ*™* YÓ/°Ó9€MØÐr)   r^   Ú	zero_copyc                 óÌ  —  G d„ d«      } |«       }d| v ri| |_         t        «       }|j                  dk(  r3|j                  |j                  t        j                  | d   «      ¬«      S |j                  || ¬«      }|S | |_        |j                  dk(  r7t        j                  |j                  t        j                  | d   «      ¬«      S t        j                  || ¬«      }|S )z.Convert array interface to numpy or cupy arrayc                   ó  — e Zd ZU dZdZee   ed<   edee   fd„«       Z	e	j                  deddfd„«       Z	edee   fd„«       Zej                  deddfd	„«       Zedeed
f   fd„«       Zedej                   fd„«       Zy)ú#from_array_interface.<locals>.Arrayz3Wrapper type for communicating with numpy and cupy.NÚ
_interfacer*   c                 ó   — | j                   S r#   )re   r%   s    r'   r(   z7from_array_interface.<locals>.Array.__array_interface__ƒ   s   € à—?‘?Ð"r)   r^   c                 óR  — t        j                   |«      | _        t        | j                  d   «      | j                  d<   | j                  d   d   | j                  d   d   f| j                  d<   | j                  j                  dd «      }|�t        |«      | j                  d<   y y )Nr;   r7   r   r   r:   )Úcopyre   ÚtupleÚget)r&   r^   r:   s      r'   r(   z7from_array_interface.<locals>.Array.__array_interface__‡   s•   € ä"Ÿi™i¨	Ó2ˆDŒOä',¨T¯_©_¸WÑ-EÓ'FˆD�O‰O˜GÑ$à—‘ Ñ'¨Ñ*Ø—‘ Ñ'¨Ñ*ð'ˆD�O‰O˜FÑ#ð —o‘o×)Ñ)¨)°TÓ:ˆGØÐ"Ü-2°7«^�—‘ 	Ò*ð #r)   c                 ó   — | j                   S r#   ©r(   r%   s    r'   r3   z<from_array_interface.<locals>.Array.__cuda_array_interface__”   s   € à×+Ñ+Ð+r)   c                 ó   — || _         y r#   rl   )r&   r^   s     r'   r3   z<from_array_interface.<locals>.Array.__cuda_array_interface__˜   s
   € à'0ˆDÕ$r)   .c                 ó,   — | j                   }|€J ‚|d   S )zShape of the input array.r;   rl   )r&   Úaifs     r'   r;   z)from_array_interface.<locals>.Array.shapeœ   s#   € ð ×*Ñ*ˆCØ�?Ð"�?Ø�w‘<Ðr)   c                 ó@   — t        j                  | j                  «      S )zTotal size of the input array.)ÚnpÚprodr;   r%   s    r'   Úsizez(from_array_interface.<locals>.Array.size£   s   € ô —7‘7˜4Ÿ:™:Ó&Ð&r)   )r,   r-   r.   Ú__doc__re   r   r+   Ú__annotations__r/   r(   Úsetterr3   r   Úintr;   rq   Úsignedintegerrs   r$   r)   r'   ÚArrayrd   ~   sæ   … ÙAà)-ˆ
�H˜XÑ&Ó-à	ð	#¨°(Ñ);ò 	#ó 
ð	#ð 
×	#Ñ	#ð
	<°ð 
	<¸dò 
	<ó 
$ð
	<ð 
ð	,¨h°xÑ.@ò 	,ó 
ð	,ð 
"×	(Ñ	(ð	1°hð 	1À4ò 	1ó 
)ð	1ð 
ð	 ˜5  c ™?ò 	 ó 
ð	 ð 
ð	'˜"×*Ñ*ò 	'ó 
ñ	'r)   ry   r>   r   r8   ©r;   rE   ©rh   )	r3   r   rs   Úemptyr;   rq   rE   Úarrayr(   )r^   ra   ry   ÚarrÚcpÚouts         r'   Úfrom_array_interfacer�   {   sÉ   € ÷('ñ ('ñT ‹'€Cð �9Ñà'0ˆÔ$Ü‹]ˆØ�8‰8�qŠ=Ø—8‘8 #§)¡)´2·8±8¸IÀiÑ<PÓ3Q�8ÓRÐRØ�h‰h�s Y ˆhÓ/ˆð €Jð #,ˆÔØ�8‰8�qŠ=Ü—8‘8 #§)¡)´2·8±8¸IÀiÑ<PÓ3QÔRÐRÜ�h‰h�s Y Ô/ˆà€Jr)   rO   Úptrr;   rE   Úis_cudac                 ó¸  — |r(t        «       j                  d|¬«      }|j                  }n#t        j                  d|¬«      }|j                  }t        | t        «      s/t        j                  | t        j                  «      j                  }n| }t        t        j                  |«      «      }|€|dk(  sJ ‚|€|S |df|d<   |rd|vr	t        |d<   ||d<   d|d	<   |S )
z2Make an __(cuda)_array_interface__ from a pointer.)r   rz   Nr   Tr7   r>   r;   r:   )r   r|   r3   rq   r(   Ú
isinstancerw   Úctypesr   Úc_void_pÚvaluerr   ÚSTREAM_PER_THREAD)r‚   r;   rE   rƒ   r|   r}   ÚaddrÚlengths           r'   Úmake_array_interfacerŒ   Â   sÓ   € ñ Ü“×#Ñ#¨$°eÐ#Ó<ˆØ×.Ñ.‰ä—‘˜t¨5Ô1ˆØ×)Ñ)ˆä�cœ3ÔÜ�{‰{˜3¤§¡Ó0×6Ñ6‰àˆÜ”—‘˜“Ó €FàÐ˜v¨š{Ð*Ð*à€|Øˆà˜4�L€Eˆ&�MÙ�8 5Ñ(Ü+ˆˆh‰Ø€Eˆ'�NØ€Eˆ)ÑØ€Lr)   zpa.DictionaryArrayc                 ó   — t        | dd«      S )z"Is this an arrow dictionary array?zpyarrow.libÚDictionaryArray)r   rH   s    r'   Úis_arrow_dictr�   ä   s   € ä˜4 Ð0AÓBÐBr)   c                   óÊ   — e Zd ZdZe	 	 dd„«       Zedd„«       Zedej                  fd„«       Zedej                  fd„«       Z
ded   fd„Zedefd	„«       Zedefd
„«       Zy)ÚDfCatAccessorz!Protocol for pandas cat accessor.r*   c                  ó   — y r#   r$   r%   s    r'   Ú
categorieszDfCatAccessor.categoriesì   s   € ð r)   c                  ó   — y r#   r$   r%   s    r'   ÚcodeszDfCatAccessor.codesñ   ó   € Ø$'r)   c                  ó   — y r#   r$   r%   s    r'   rE   zDfCatAccessor.dtypeô   s   € Ø!$r)   c                  ó   — y r#   r$   r%   s    r'   rB   zDfCatAccessor.values÷   r–   r)   )úpa.StringArrayúpa.IntegerArrayc                  ó   — y r#   r$   r%   s    r'   Úto_arrowzDfCatAccessor.to_arrowú   s   € à58r)   c                  ó   — y r#   r$   r%   s    r'   r3   z&DfCatAccessor.__cuda_array_interface__þ   s   € Ø8;r)   c                  ó   — y r#   r$   r%   s    r'   Ú_columnzDfCatAccessor._column  s   € Ø!r)   N)r*   zpd.Index)r*   ú	pd.Series)r,   r-   r.   rt   r/   r“   r•   rq   rE   ÚndarrayrB   r   rœ   r4   r3   r   rŸ   r$   r)   r'   r‘   r‘   é   s˜   „ Ù+àðà	òó ðð Ú'ó Ø'àØ$�r—x‘xÒ$ó Ø$àØ'˜Ÿ
™
Ò'ó Ø'ð9à	Ð2Ñ	3ó9ð Ø;¨,Ò;ó Ø;àØ!˜Ò!ó Ù!r)   r‘   c                 ó6   — t        | d«      xr t        | d«      S )Nr“   r•   )rG   rH   s    r'   Ú
_is_df_catr£     s   € ä�4˜Ó&ÒA¬7°4¸Ó+AÐAr)   c                  ó¼  — dd l }  | j                  «       t        j                   | j                  «       t        j                   | j                  «       t        j                   | j
                  «       t        j
                   | j                  «       t        j                   | j                  «       t        j                   | j                  «       t        j                   | j                  «       t        j                   | j                  «       t        j                   | j                  «       t        j                   | j                  «       t        j                  i}|S )Nr   )ÚpyarrowÚint8rq   Úint16Úint32Úint64Úuint8Úuint16Úuint32Úuint64Úfloat16Úfloat32Úfloat64)ÚpaÚmappings     r'   Ú_arrow_npdtyper³   
  sÐ   € ãð 	ˆ�‰‹	”2—7‘7Øˆ�‰‹
”B—H‘HØˆ�‰‹
”B—H‘HØˆ�‰‹
”B—H‘HØˆ�‰‹
”B—H‘HØˆ�	‰	‹”R—Y‘YØˆ�	‰	‹”R—Y‘YØˆ�	‰	‹”R—Y‘YØˆ�
‰
‹”b—j‘jØˆ�
‰
‹”b—j‘jØˆ�
‰
‹”b—j‘jð+€Gð €Nr)   Úaddressr8   rs   r>   c                  ó   — y r#   r$   ©r´   r8   rs   r>   s       r'   Ú_arrow_buf_infr·     s   € ØUXr)   c                  ó   — y r#   r$   r¶   s       r'   r·   r·   #  s   € ð r)   c                 ó@   — |�| df|dd |fd |dœ}|S | df|dd |fd dœ}|S )NTr5   r=   r6   r$   )r´   r8   rs   r>   ÚjcuaifÚjaifs         r'   r·   r·   )  s[   € ð Ðà˜d�OØØØØ�WØØñ 
ˆð ˆð ˜$�ØØØØ�Øñ€Dð €Kr)   Úcatsr™   c                 óÒ  ‡— t         s
t        «       }| j                  dk(  sJ ‚| j                  «       }|\  }}}|j                  sJ ‚t        | «      dz   Šdt        dt        fˆfd„}|j                   |t        j                  «      k(  rgt        | j                  «      sd}t        |dt        | «      › d�z   «      ‚| j                   |j                   «       «      }|j                  «       \  }}}|j                   |t        j"                  «      k7  rt        d	«      ‚t%        |j&                  d
‰d «      }	t%        |j&                  d|j                  d «      }
|�J ‚|	|
dœ}||||ffS )Nr   r   Útypr*   c                 óN   •— ‰t        j                  | «      j                  dz  z  S )Né   )rq   ÚiinfoÚbits)r¾   Úoff_lens    €r'   Úget_n_bytesz)_arrow_cat_names_inf.<locals>.get_n_bytesP  s!   ø€ Øœ"Ÿ(™( 3›-×,Ñ,°Ñ1Ñ2Ð2r)   zExpecting a `pyarrow.Array`.z Got: ú.z?Arrow dictionary type offsets is required to be 32-bit integer.ú<i4ú|i1r@   )r   r   ÚoffsetÚbuffersÚis_cpuÚlenr   rw   rs   rq   r©   r…   ÚLargeStringArrayÚ	TypeErrorÚtyper   Ústringr¨   r·   r´   )r¼   r±   rÉ   r<   rÈ   r7   rÄ   Úarrow_str_errorÚi32catsÚjoffsetÚjdataÚjnamesrÃ   s               @r'   Ú_arrow_cat_names_infrÕ   C  sR  ø€ ÝÜÓˆð �;‰;˜!ÒÐÐØ#Ÿ|™|›~€GØ Ñ€Dˆ&�$Ø�=Š=Ðˆ=ä�$‹i˜!‰m€Gð3œð 3¤#õ 3ð ‡{�{‘k¤"§(¡(Ó+Ò+Ü˜$ × 3Ñ 3Ô4Ø<ˆOÜ˜O°´t¸D³z°lÀ!Ð.DÑDÓEÐEð —)‘)˜I˜BŸI™I›KÓ(ˆØ$Ÿ_™_Ó.Ñˆˆf�dà‡{�{‘k¤"§(¡(Ó+Ò+ÜØMó
ð 	
ô ˜VŸ^™^¨U°G¸TÓB€GÜ˜4Ÿ<™<¨°·	±	¸4Ó@€Eàˆ<Ðˆ<à&-¸Ñ?€FØ�D˜& $Ð'Ð'Ð'r)   r}   zpa.Arrayc                 ó¨  — t         s
t        «       }t        | j                  «      st	        dt        | «      › �«      ‚| j                  «       \  }}t        |j                  t        | «      ft        «       | j
                     |j                   ¬«      }|�5|j                  dfdddt        | «      fddœ}|j                  st        |d<   nd}||d	<   |S )
z&Helper for handling categorical codes.zInvalid input type: )r;   rE   rƒ   NTz<t1r5   r6   r>   r<   )r   r   r…   ry   rÍ   rÎ   rÉ   rŒ   r´   rË   r³   rÊ   r‰   )r}   r±   r<   r7   rÓ   Újmasks         r'   Ú_arrow_array_infrØ   j  sÊ   € õ ÜÓˆÜ�e˜RŸX™XÔ&ÜÐ.¬t°E«{¨mÐ<Ó=Ð=à—‘“�J€Dˆ$Ü Ø�‰Ü�5‹zˆmÜÓ˜uŸz™zÑ*Ø—K‘K�ô	€Eð Ðà—\‘\ 4Ð(ØØØÜ˜%“j�]Øñ%
ˆð �{Š{Ü/ˆE�(ŠOàˆà€Eˆ&�MØ€Lr)   r•   rš   c                 óB   — t        | «      \  }}t        |«      }|||dffS )zHGet the array interface representation of a string-based category array.N)rÕ   rØ   )r¼   r•   rÔ   Úcats_tmpÚjcodess        r'   Úarrow_cat_infrÜ   �  s/   € ô
 ,¨DÓ1Ñ€FˆHÜ˜eÓ$€Fà�6˜H dÐ+Ð+Ð+r)   c                 ó  — t        | «      s,| j                  t        j                  t        j                  fv r#t        j
                  }| j                  |d¬«      } | j                  j                  st        j                  | d¬«      } | |fS )z7Ensure the np array has correct type and is contiguous.Fr{   ÚA)Úrequirements)
rI   rE   rq   r®   Úbool_r¯   ÚastypeÚflagsÚalignedÚrequire)r7   rE   s     r'   Ú_ensure_np_dtyperå   ˜  sf   € ô �tÔ §
¡
¬r¯z©z¼2¿8¹8Ð.DÑ DÜ—
‘
ˆØ�{‰{˜5 uˆ{Ó-ˆØ�:‰:×ÒÜ�z‰z˜$¨SÔ1ˆØ�ˆ;Ðr)   c                 óZ   — t        | j                  «      dk(  xs | j                  d   dk(  S )Nr   )rË   r;   )r}   s    r'   Ú_is_flattenrç   ¤  s(   € Üˆu�{‰{Ó˜qÑ Ò7 E§K¡K°¡N°aÑ$7Ð7r)   c                 ó’   — t        | «      rt        d«      ‚| j                  }d|v r|d   j                  |d<   t        t        |«      S )z*Returns an array interface from the input.rK   r<   )rI   rQ   r(   r   r+   )r7   rT   s     r'   Úarray_interface_dictré   ¨  sH   € ä�tÔÜÐWÓXÐXØ×#Ñ#€DØ��~Ø˜F‘|×7Ñ7ˆˆV‰Ü”˜$ÓÐr)   r    c                 ó¶  ‡ — |j                  dt        j                  «      }dt        fˆ fd„} |«       r5‰ j                  }t        |«      }|j                  }t        |«      }||||ffS dt        dt        t        j                  t        f   fd„} |‰ j                  «      \  }}	t        |t        j                  «      \  }}
t        |«      }|	j                  d«      }t        j                  j                  t        j                   |«      «      j"                  }|€J ‚|dfd	t%        |	«      fdd
ddœ}||dœ}|j                  }t        |«      }||	||f}|||fS )zCGet the array interface representation of pandas category accessor.éÿÿÿÿr*   c                  óÐ   •— ‰j                   } 	 t        j                  | t        j                  «      xs$ t        j                  | t        j                  «      S # t
        $ r Y yw xY w)NF)rE   rq   Ú
issubdtypeÚfloatingÚintegerrÍ   )rE   r¼   s    €r'   Úis_primzpd_cat_inf.<locals>.is_prim¹  sL   ø€ Ø—
‘
ˆð	Ü—=‘= ¬¯©Ó4ÒX¼¿¹ÀeÌRÏZÉZÓ8XÐXøÜò 	Ùð	ús   �A	A Á	A%Á$A%Ústrarrc                 ó  — t        | t        j                  «      s>t        | d«      r| j	                  t
        ¬«      } nt        j                  | t
        ¬«      } t        j                  t        «      }t        j                  t        j                  t        j                  dgt        j                  ¬«       || «      g«      «      }| j                  j                  dk(  r-| j                  «       D �cg c]  }|j!                  d«      ‘Œ }}n&| j                  «       D �cg c]  }t#        |«      ‘Œ }}dj%                  |«      }d|v rt'        j(                  dt*        «       |j-                  t        j.                  «      |fS c c}w c c}w )	z5Convert a string-like array to an arrow string array.Úto_numpy)rE   r   ÚSrY   Ú ú zzFound embedded NUL (\0) characters in string categories. Arrow used to strip these characters, but they are now preserved.)r…   rq   r¡   rG   ró   ÚobjectÚasarrayÚ	vectorizerË   ÚcumsumÚconcatenater}   r©   rE   ÚkindÚtolistÚdecodeÚstrÚjoinÚwarningsÚwarnÚUserWarningrá   r¨   )rñ   ÚlenarrrA   ÚsÚstr_listrB   s         r'   Únpstr_to_arrow_strarrz)pd_cat_inf.<locals>.npstr_to_arrow_strarrÈ  s  € ä˜&¤"§*¡*Ô-Ü�v˜zÔ*ØŸ™¬v˜Ó6‘äŸ™ F´&Ô9�ä—‘œcÓ"ˆÜ—)‘)Ü�N‰NœBŸH™H a S´·±Ô9¹6À&»>ÐJÓKó
ˆð �<‰<×Ñ Ò#Ø39·=±=³?ÖC¨a˜Ÿ™ Õ)ÐCˆHÑCà(.¯©«Ö8 1œ˜A�Ð8ˆHÐ8Ø—‘˜Ó"ˆØ�6‰>Ü�M‰MðXô ôð �~‰~œbŸh™hÓ'¨Ð/Ð/ùò Dùâ8s   Ã1FÄFrY   NTrÇ   r5   )r7   r8   r;   r:   r9   r<   r@   )Úreplacerq   ÚnanÚboolrB   ré   r   r   r¡   rÿ   rå   r¨   Úencoder†   r‡   Úfrom_bufferÚc_char_prˆ   rË   )r¼   r•   rð   Úname_values_numÚjarr_valuesÚcode_valuesÚ
jarr_codesr  Úname_offsetsÚname_valuesÚ_ÚjoffsetsÚbvaluesr‚   ÚjvaluesrÔ   rÛ   Úbufs   `                 r'   Ú
pd_cat_infr  ²  s^  ø€ ð
 �M‰M˜"œbŸf™fÓ%€Eð”Tõ ñ „yàŸ+™+ˆÜ*¨?Ó;ˆØ—l‘lˆÜ)¨+Ó6ˆ
Ø˜J¨¸+Ð(FÐFÐFð0¤cð 0¬e´B·J±JÄ°OÑ.Dó 0ñ8 !6°d·k±kÓ BÑ€L�+Ü& |´R·X±XÓ>�O€L�!Ü# LÓ1€HØ× Ñ  Ó)€Gä
�/‰/×
%Ñ
%¤f§o¡o°gÓ&>Ó
?×
EÑ
E€CØˆ?Ðˆ?ð �d�ØÜ�kÓ"Ð$ØØØñ€Gð '/¸'ÑB€Fà—,‘,€KÜ! +Ó.€Fð 	ØØØð	€Cð �6˜3ÐÐr)   c                 óZ   — t        | «      }t        t        j                  |«      d«      }|S )zMake array interface str.rY   )ré   rZ   r[   r\   r]   s      r'   Úarray_interfacer    s'   € ä$ TÓ*€IÜœ$Ÿ*™* YÓ/°Ó9€MØÐr)   Úfieldc                 ó\   — d| j                   v r| j                   d   �t        d|› �«      ‚yy)z(Make sure no missing value in meta data.r<   Nz"Missing value is not allowed for: )r3   rQ   )r7   r  s     r'   Úcheck_cudf_metar  	  s@   € ð 	�$×/Ñ/Ñ/Ø×)Ñ)¨&Ñ1Ð=äÐ=¸e¸WÐEÓFÐFð >ð 	0r)   c                 ó   — ddl }| j                  j                  «       }|j                  «       j	                  «       |j
                  j                  k7  rt        d«      ‚|j                  «       dk(  sJ ‚|j                  «       dk(  sJ ‚|j                  «       d   }|j                  «       j	                  «       |j
                  j                  k(  sJ d«       ‚t        |j                  «       j                  d   d   ddt        «      }t        |j                  «       j                  d   d   d|j!                  «       t        «      }||dœ}||ffS )	z7String category index path for :py:func:`cudf_cat_inf`.r   NzDUnexpected type for category index. It's neither numeric nor string.zExpected INT32 string offsets.r7   rÇ   rÆ   r@   )Ú	pylibcudfrŸ   Úto_pylibcudfrÎ   ÚidÚTypeIdÚSTRINGrÍ   Ú
null_countrÈ   ÚchildrenÚINT32r·   r7   r3   r‰   rs   )r¼   ÚplcÚplc_colÚ	off_childrÓ   rÒ   rÔ   s          r'   Ú_cudf_str_cat_infr+    s8  € ãð �l‰l×'Ñ'Ó)€GØ‡|�|ƒ~×ÑÓ˜cŸj™j×/Ñ/Ò/ÜØRó
ð 	
ð ×ÑÓ 1Ò$Ð$Ð$Ø�>‰>Ó˜qÒ Ð Ð à× Ñ Ó" 1Ñ%€IØ�>‰>Ó×ÑÓ  C§J¡J×$4Ñ$4Ò4ÐVÐ6VÓVÐ4ô )Ø�‰‹×/Ñ/°Ñ7¸Ñ:ØØ	Üó	€Eô +Ø�‰Ó×1Ñ1°&Ñ9¸!Ñ<ØØ�‰ÓÜó	€Gð +2¸UÑC€Fð �G�:ÐÐr)   c                 ó,  — t        «       }|j                  | j                  |j                  «      xs& |j                  | j                  |j                  «      }|rt        | «      }t        |«      }||| |ffS t        | «      \  }}t        |«      }|||fS )z4Obtain the cuda array interface for cuDF categories.)r   rí   rE   rî   rï   rW   r+  )	r¼   r•   r   Ú
is_num_idxÚ	cats_ainfÚ
codes_ainfrÔ   r  rÛ   s	            r'   Úcudf_cat_infr0  6  s�   € ô 
‹€BØ—‘˜tŸz™z¨2¯;©;Ó7ò ¸2¿=¹=Ø�
‰
�B—J‘Jó<€Jñ Ü-¨dÓ3ˆ	Ü.¨uÓ5ˆ
Ø˜* t¨U mÐ3Ð3ä# DÓ)�K€FˆCÜ& uÓ-€FØ�6˜3ÐÐr)   c                   ó~   — e Zd ZdZdeej                  eg df   f   dee	   ddfd„Z
de	fd„Zdefd„Zdefd	„Zdd
„Zy)Ú
Categoriesa  An internal storage class for categories returned by the DMatrix and the
    Booster. This class is designed to be opaque. It is intended to be used exclusively
    by XGBoost as an intermediate storage for re-coding categorical data.

    The categories are saved along with the booster object. As a result, users don't
    need to preserve this class for re-coding. Use the booster model IO instead if you
    want to preserve the categories in a stable format.

    .. versionadded:: 3.1.0

    .. warning::

        This class is internal.

    .. code-block:: python

        Xy = xgboost.QuantileDMatrix(X, y, enable_categorical=True)
        booster = xgboost.train({}, Xy)

        categories = booster.get_categories() # Get categories

        # Use categories as a reference for re-coding
        Xy_new = xgboost.QuantileDMatrix(
            X_new, y_new, feature_types=categories, enable_categorical=True, ref=Xy
        )

        # Categories will be part of the `model.json`.
        booster.save_model("model.json")

    ÚhandleNÚarrow_arraysr*   c                 ó0   — |\  | _         | _        || _        y r#   )Ú_handleÚ_freeÚ_arrow_arrays)r&   r3  r4  s      r'   Ú__init__zCategories.__init__h  s   € ð $*Ñ ˆŒ�d”jØ)ˆÕr)   c                 óH   — | j                   €t        d«      ‚| j                   S )ao  Get the categories in the dataset. The results are stored in a list of
        (feature name, arrow array) pairs, with one array for each categorical
        feature. If a feature is numerical, then the corresponding column in the list is
        None. A value error will be raised if this container was created without the
        `export_to_arrow` option.

        zHThe `export_to_arrow` option of the `get_categories` method is required.)r8  rQ   r%   s    r'   rœ   zCategories.to_arrowu  s0   € ð ×ÑÐ%Üð óð ð ×!Ñ!Ð!r)   c                 ó2   — | j                   j                  du S )z$Returns True if there's no category.N©r6  rˆ   r%   s    r'   r|   zCategories.empty„  s   € à�|‰|×!Ñ! TÐ)Ð)r)   c                 ó^   — | j                   j                  sJ ‚| j                   j                  S )z*Internal method for retrieving the handle.r<  r%   s    r'   Ú
get_handlezCategories.get_handleˆ  s%   € à�|‰|×!Ò!Ð!Ð!Ø�|‰|×!Ñ!Ð!r)   c                 óR   — | j                   j                  €y | j                  «        y r#   )r6  rˆ   r7  r%   s    r'   Ú__del__zCategories.__del__�  s   € Ø�<‰<×ÑÐ%ØØ�
‰
�r)   )r*   N)r,   r-   r.   rt   r   r†   r‡   r   r   r   r9  rœ   r
  r|   rw   r>  r@  r$   r)   r'   r2  r2  H  sm   „ ñð>*à�f—o‘o x°°D°Ñ'9Ð9Ñ:ð*ð ˜|Ñ,ð*ð 
ó	*ð"˜,ó "ð*�tó *ð"˜Có "ô
r)   r2  Úfeature_typesc                 ó>   — t        | t        «      r| }d} | |fS d}| |fS )z¼Get the optional reference categories from the `feature_types`. This is used by
    various `DMatrix` where the `feature_types` is reused for specifying the reference
    categories.

    N)r…   r2  )rA  Úref_categoriess     r'   Úget_ref_categoriesrD  “  s7   € ô �-¤Ô,Ø&ˆØˆð ˜.Ð(Ð(ð ˆØ˜.Ð(Ð(r)   ÚAifTypec                   ój   — e Zd ZdZdee   dedee   ddfd„Z	de
fd„Zeedeeef   fd	„«       «       Zy)
ÚTransformedDfzÛInternal class for storing transformed dataframe.

    Parameters
    ----------
    ref_categories :
        Optional reference categories used for re-coding.

    aitfs :
        Array interface for each column.

    rC  ÚaitfsÚtemporary_buffersr*   Nc                 ó�   — || _         |�(|j                  «       �|j                  «       }|| _        nd | _        || _        || _        y r#   )rC  r>  Úref_aifrH  rI  )r&   rC  rH  rI  ro   s        r'   r9  zTransformedDf.__init__¿  sK   € ð -ˆÔØÐ%¨.×*CÑ*CÓ*EÐ*QØ ×+Ñ+Ó-ˆCØ*-ˆD�LàˆDŒLàˆŒ
Ø!2ˆÕr)   c                 óä   — | j                   �:| j                  | j                  dœ}t        t	        j
                  |«      d«      }|S t        t	        j
                  | j                  «      d«      }|S )z6Return a byte string for JSON encoded array interface.)rC  ÚcolumnsrY   )rC  rK  rH  rZ   r[   r\   )r&   Úref_infÚinfs      r'   r  zTransformedDf.array_interfaceÏ  s\   € à×ÑÐ*Ø/3¯|©|ÈÏ
É
ÑSˆGÜœŸ
™
 7Ó+¨WÓ5ˆCð ˆ
ô œŸ
™
 4§:¡:Ó.°Ó8ˆCØˆ
r)   c                  ó   — y)z"Return the shape of the dataframe.Nr$   r%   s    r'   r;   zTransformedDf.shapeØ  s   � r)   )r,   r-   r.   rt   r   r2  rE  r
   r   r9  rZ   r  r/   r   rw   r;   r$   r)   r'   rG  rG  ²  sr   „ ñ
ð3à  Ñ,ð3ð ð3ð   ™;ð	3ð
 
ó3ð  ó ð Øð1�u˜S #˜X‘ò 1ó ó ñ1r)   rG  )F)Trt   rh   r†   r[   r  Úabcr   r   Ú	functoolsr   ÚfcacheÚtypingr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   Únumpyrq   Ú_typingr   r   r   r   r   r   Úcompatr   r   r   ÚpandasÚpdr¥   r±   r!   r1   rw   r
  rÿ   r+   r4   r?   rC   rI   rW   rZ   r`   r�   r‰   ÚnumberrŒ   r�   r‘   r£   r³   r·   rÕ   rØ   rÜ   r¡   rå   rç   ré   r  r  r  r+  r0  r2  rD  rE  ru   rG  r$   r)   r'   ú<module>r[     s/  ðÚ 1ã Û Û Û ß #Ý %÷÷ ÷ ÷ ó ó& ÷÷ ÷ AÑ @áÛÛô5�Hô 5ô
>˜ô >ñ
 Øà�c˜4�iÑ ØØ˜1‘:Ø˜E # s (™OÑ,Ø�s˜C�x‘Ø�j $¨Ð5Ñ6ñó
€ñ Øà�c˜4�iÑ ØØ˜1‘:Ø˜E # s (™OÑ,Ø�s˜C�x‘Ø�j $¨Ð5Ñ6Øñó€ñ ˜°8ÀxÑ'PÓQ€ÙØ <¸<ÑHó€ð
˜(ð  tó ðÐ$5ð ¸,ó ð(Ð0ð °Uó ñ> Hð >¸ð >È+ó >ðD Ð ð
Ø	ˆ{˜CÐÑ	 ðà��c�‰?ðð �—	‘	‰?ðð ð	ð
 óðDC˜ð C 	Ð*>Ñ ?ó Cô
"�Hô "ð8B�Sð B˜Y }Ñ5ó Bð
 ð˜˜S $ r§y¡y¡/Ð1Ñ2ò ó ðð( 
Ø X˜CÐ X¨#Ð X°SÐ XÀ$Ð XÈ8Ò Xó 
Ø Xð 
ðØðØðØ&)ðØ36ðàòó 
ðð
ØðØðØ&)ðØ3;¸C±=ðà
ˆ8�\Ð!Ñ"óð4$(Ð/ð $(°E¸+ÀsÐ:JÑ4Kó $(ðN Øð àó ðF,Ø
ð,à�Ð 1Ð3DÐDÑEð,ð ˆ;˜ %Ð'Ñ(ó,ð	Ø
ð	Ø# JÑ/ð	à
ˆ2�:‰:�x 
Ñ+Ð+Ñ,ó	ð8�{ð 8 tó 8ð ˜rŸz™zð  ¨hó  ðMØ
ðMØ +ðMà
ˆ5�˜hÐ&Ñ'¨°5Ð8Ñ9óMð`˜"Ÿ*™*ð ¨ó ðGÐ+ð G°Cð G¸Dó Gð!˜Mð !¨e°OÀUÐ4JÑ.Kó !ðHØ
ðØ +ðà
ˆ5�˜Ð.Ñ/°¸5Ð@ÑAó÷$Hñ HðV)Ø˜E ,°
Ð":Ñ;Ñ<ð)à
ˆ8�LÑ! 8¨JÑ#7Ð7Ñ8ó)ð" Ø	àˆh˜Ð$Ñ%àà�(˜L¨+°ÐFÑGØ�(˜LÐ(Ñ)ð+ñ	
ð	ñ	ñ€ˆó ô)1�Cõ )1r)   