
    :[g7                        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m	Z	m
Z
mZmZ ddlZddlmZ ej"                  d   dk(  sJ d       ded	efd
Zdededed	efdZ	 ddlmZmZmZ ddlmZ dZ	 ddl m!Z" ddl m#Z$ ddl m%Z& ddl'm(Z( 	 ddl)m*Z+ ddl)m,Z- dZ/ ej`                  e1      Z2d	efdZ3d	efdZ4d	ejj                  fdZ6	 ddl7m8Z9 ddl7m:Z; dee   d	efdZ G d d ejj                        Z<y# e$ r eZeZeZdZdZY w xY w# e$ r ddl.m*Z+ ddl.m,Z- Y w xY w# e$ r dZ/eZ"eZ$eZ&eZ(dZ+dZ-Y w xY w# e$ r dZ9eZ;Y qw xY w)!z,For compatibility and optional dependencies.    N)AnyDictListOptionalSequencecast   )_T   z Python 2 is no longer supported.xreturnc                 $    | j                  d      S )z&convert c string back to python stringzutf-8)decode)r   s    I/var/www/html/bid-api/venv/lib/python3.12/site-packages/xgboost/compat.pypy_strr      s    88G    instancemodulenamec                 b    | j                   }|j                  |k(  }|j                  |k(  }|xr |S )z-Use string representation to identify a type.)	__class__
__module____name__)r   r   r   clsis_same_modulehas_same_names         r   lazy_isinstancer      s6    
 

C^^v-NLLD(M+m+r   )	DataFrame
MultiIndexSeriesconcatTF)BaseEstimator)ClassifierMixin)RegressorMixin)LabelEncoder)KFold)StratifiedKFoldc                      t         j                  j                  d      y	 ddl} y# t        $ r t
        j                  d       Y yw xY w)z#Check cuDF package available or notcudfNFr   Tz1Importing cuDF failed, use DMatrix instead of QDM)	importlibutil	find_specr*   ImportError_logger	exception)r*   s    r   is_cudf_availabler1   N   sF    ~~'/ MNs   ' AAc                  l    t         j                  j                  d      y	 ddl} y# t        $ r Y yw xY w)z#Check cupy package available or notcupyNFr   T)r+   r,   r-   r3   r.   r3   s    r   is_cupy_availabler5   [   s7    ~~'/ s   ' 	33c                  8    t               st        d      ddl} | S )zImport cupy.z,`cupy` is required for handling CUDA buffer.r   N)r5   r.   r3   r4   s    r   import_cupyr7   g   s    HIIKr   )
csr_matrixvaluec                    t        | d   t        j                        r8t        t        t        j                     |       }t        j
                  |d      S t        r4t        | d   t        j                        rt        j                  | d      S t        r4t        | d   t        j                        rt        j                  | d      S t        r4t        | d   t        j                        rt        j                  | d      S t        r&t        | d   t        t        f      rt        | d      S t        | d   dd      st        | d   dd	      rdd
lm}  || d      S ddlm}  || d         rzddl}|j*                  j,                  j/                         }| D ]:  }t        |j                  |      }|j0                  j2                  }||k(  r5J d        |j                  | d      S t5        d      )zConcatenate row-wise.r   )axiscsr)formatcsczcudf.core.dataframer   zcudf.core.seriesr    r!   r	   )_is_cupy_alikeNz*Concatenating arrays on different devices.zUnknown type.)
isinstancenpndarrayr   r   concatenatescipy_sparser8   vstack
csc_matrixspmatrixPANDAS_INSTALLEDr   r    pandas_concatr   r*   r"   datar?   r3   cudaruntime	getDevicedeviceid	TypeError)	r9   	value_arrCUDF_concatr?   r3   dvarrd_vs	            r   r"   r"   y   s   %(BJJ'"**-u5	~~ia00
58\-D-DE""577
58\-D-DE""577
58\-B-BC""577JuQx)V1DEU++uQx!6Da$hI 	/5q))$eAh II'')At||Q'C**--C!8III8  A..
O
$$r   c                        e Zd ZdZ	 ddedededee   ddf
 fdZdej                  fd	Z
d
edefdZdee   fdZ xZS )
LazyLoaderzFLazily import a module, mainly to avoid pulling in large dependencies.N
local_nameparent_module_globalsr   warningr   c                 \    || _         || _        || _        d | _        t        |   |       y N)_local_name_parent_module_globals_warningr   super__init__)selfrY   rZ   r   r[   r   s        r   rb   zLazyLoader.__init__   s0     &&;#26r   c                 $   t        j                  | j                        }|| j                  | j                  <   | j
                  rt        j                  | j
                         d| _        | j                  j                  |j                         |S )z8Load the module and insert it into the parent's globals.N)
r+   import_moduler   r_   r^   r`   loggingr[   __dict__update)rc   r   s     r   _loadzLazyLoader._load   sk     ((78>##D$4$45 ==OODMM*
 	V__-r   itemc                 p    | j                   s| j                         | _         t        | j                   |      S r]   )r   ri   getattr)rc   rj   s     r   __getattr__zLazyLoader.__getattr__   s'    {{**,DKt{{D))r   c                 n    | j                   s| j                         | _         t        | j                         S r]   )r   ri   dir)rc   s    r   __dir__zLazyLoader.__dir__   s%    {{**,DK4;;r   r]   )r   r   __qualname____doc__strr   r   rb   types
ModuleTyperi   r   rm   r   rp   __classcell__)r   s   @r   rX   rX      sy    P "&  $ 	
 # 
u'' &* * *
 c  r   rX   )=rr   importlib.utilr+   rf   sysrt   typingr   r   r   r   r   r   numpyrA   _typingr
   version_infobytesrs   r   boolr   pandasr   r   r    r"   rI   rH   r.   objectsklearn.baser#   XGBModelBaser$   XGBClassifierBaser%   XGBRegressorBasesklearn.preprocessingr&   sklearn.model_selectionr'   XGBKFoldr(   XGBStratifiedKFoldsklearn.cross_validationSKLEARN_INSTALLED	getLoggerr   r/   r1   r5   ru   r7   scipy.sparsesparserD   r8   	scipy_csrrX    r   r   <module>r      s   2   
  < <  
a C!C Ce  
,c ,3 ,c ,d ,
44.:A?2S=Q
  '

H
%
4 
	4 	U%% '4 %(2,  %2  %f, !! , M  JIFM$  S>RS  
 LLH
l  LIsZ   C1 .D D D D6 1DDDD DD D32D36	EE