
    i^	                         d Z ddlZddlmZmZ ddlmZmZ ddlZ	ddl
mZmZmZmZ ddlmZmZ ddlmZ erdd	lmZ  G d
 de      Z G d de      ZdededefdZy)zExperimental support for a new objective interface with target dimension
reduction.

.. warning::

  Do not use this module unless you want to participate in development.

.. versionadded:: 3.2.0

    N)ABCabstractmethod)TYPE_CHECKINGTuple   )_ensure_np_dtype_is_flattenarray_interfacecuda_array_interface)	ArrayLikeNumpyOrCupy)_is_cupy_alike)DMatrixc                   <    e Zd ZdZedededddeeef   fd       Zy)		ObjectivezBase class for custom objective functions.

    .. warning::

        Do not use this class unless you want to participate in development.

    .. versionadded:: 3.2.0

    	iterationy_preddtrainr   returnc                      y )N )selfr   r   r   s       W/home/ubuntu/crypto_trading_bot/.venv/lib/python3.12/site-packages/xgboost/objective.py__call__zObjective.__call__*   s     '*    N)	__name__
__module____qualname____doc__r   intr   r   r   r   r   r   r   r      sE     **&/*9B*	y)#	$* *r   r   c            
       8    e Zd ZdZdedededeeef   dz  fdZy)TreeObjectivezBase class for tree-specific custom objective functions.

    .. warning::

        Do not use this class unless you want to participate in development.

    .. versionadded:: 3.2.0

    r   gradhessr   Nc                      y)z>Provide a different gradient type for finding tree structures.Nr   )r   r   r#   r$   s       r   
split_gradzTreeObjective.split_grad<   s     r   )r   r   r   r   r    r   r   r&   r   r   r   r"   r"   0   s;    $-5>	y)#	$t	+r   r"   array	n_samplesr   c                    dt        |        }t        | t        j                        st	        |       st        |      | j                  d   |k7  rDt        |       r9t        j                  dt               | j                  || j                  |z        } t        | t        j                        r&t        | | j                        \  } }t        |       }|S t	        |       rt!        |       }|S t        |      )NzHExpecting `np.ndarray` or `cupy.ndarray` for gradient and hessian. Got: r   zvSince 2.1.0, the shape of the gradient and hessian is required to be (n_samples, n_targets) or (n_samples, n_classes).)type
isinstancenpndarrayr   	TypeErrorshaper	   warningswarnFutureWarningreshapesizer   dtyper
   r   )r'   r(   msg_	interfaces        r   _grad_arrinfr9   C   s    	e	  eRZZ(1Fn{{1~"{5'9D	

 iy)@A%$#E5;;7q#E*	  
	(/	  nr   )r   r0   abcr   r   typingr   r   numpyr,   _data_utilsr   r	   r
   r   _typingr   r   compatr   corer   r   r"   r    bytesr9   r   r   r   <module>rB      sb   	  # '   , "* *"I &   r   