§
    ¨éUg¡  ã                   óú  — d Z ddl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mZmZmZmZmZmZmZmZmZmZ dd	lmZmZmZmZmZmZ  G d
„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z  G d„ de¦  «        Z! G d„ de¦  «        Z" G d„ de¦  «        Z# G d„ de¦  «        Z$ G d„ de¦  «        Z% G d„ de¦  «        Z& G d„ de¦  «        Z' G d „ d!e¦  «        Z(eee e!e"e#e$e&e'e(d"œ
Z)dS )#z¹
This module contains loss classes suitable for fitting.

It is not part of the public API.
Specific losses are used for regression, binary classification or multiclass
classification.
é    N©Úxlogyé   )Úcheck_scalar)Ú_weighted_percentileé   )ÚCyAbsoluteErrorÚCyExponentialLossÚCyHalfBinomialLossÚCyHalfGammaLossÚCyHalfMultinomialLossÚCyHalfPoissonLossÚCyHalfSquaredErrorÚCyHalfTweedieLossÚCyHalfTweedieLossIdentityÚCyHuberLossÚCyPinballLoss)ÚHalfLogitLinkÚIdentityLinkÚIntervalÚ	LogitLinkÚLogLinkÚMultinomialLogitc                   óœ   — e Zd ZdZdZdZdZdd„Zd„ Zd„ Z		 	 	 dd	„Z
	 	 	 	 dd
„Z	 	 	 dd„Z	 	 	 	 dd„Zdd„Zdd„Zdd„Zej        dfd„ZdS )ÚBaseLossa  Base class for a loss function of 1-dimensional targets.

    Conventions:

        - y_true.shape = sample_weight.shape = (n_samples,)
        - y_pred.shape = raw_prediction.shape = (n_samples,)
        - If is_multiclass is true (multiclass classification), then
          y_pred.shape = raw_prediction.shape = (n_samples, n_classes)
          Note that this corresponds to the return value of decision_function.

    y_true, y_pred, sample_weight and raw_prediction must either be all float64
    or all float32.
    gradient and hessian must be either both float64 or both float32.

    Note that y_pred = link.inverse(raw_prediction).

    Specific loss classes can inherit specific link classes to satisfy
    BaseLink's abstractmethods.

    Parameters
    ----------
    sample_weight : {None, ndarray}
        If sample_weight is None, the hessian might be constant.
    n_classes : {None, int}
        The number of classes for classification, else None.

    Attributes
    ----------
    closs: CyLossFunction
    link : BaseLink
    interval_y_true : Interval
        Valid interval for y_true
    interval_y_pred : Interval
        Valid Interval for y_pred
    differentiable : bool
        Indicates whether or not loss function is differentiable in
        raw_prediction everywhere.
    need_update_leaves_values : bool
        Indicates whether decision trees in gradient boosting need to uptade
        leave values after having been fit to the (negative) gradients.
    approx_hessian : bool
        Indicates whether the hessian is approximated or exact. If,
        approximated, it should be larger or equal to the exact one.
    constant_hessian : bool
        Indicates whether the hessian is one for this loss.
    is_multiclass : bool
        Indicates whether n_classes > 2 is allowed.
    TFNc                 óÆ   — || _         || _        d| _        d| _        || _        t          t          j         t          j        dd¦  «        | _        | j        j	        | _	        d S )NF)
ÚclossÚlinkÚapprox_hessianÚconstant_hessianÚ	n_classesr   ÚnpÚinfÚinterval_y_trueÚinterval_y_pred)Úselfr   r   r!   s       úQ/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/sklearn/_loss/loss.pyÚ__init__zBaseLoss.__init__‚   sV   € ØˆŒ
ØˆŒ	Ø#ˆÔØ %ˆÔØ"ˆŒÝ'­¬¨µ´¸ÀÑFÔFˆÔØ#œyÔ8ˆÔÐÐó    c                 ó6   — | j                              |¦  «        S ©zuReturn True if y is in the valid range of y_true.

        Parameters
        ----------
        y : ndarray
        )r$   Úincludes©r&   Úys     r'   Úin_y_true_rangezBaseLoss.in_y_true_range‹   ó   € ð Ô#×,Ò,¨QÑ/Ô/Ð/r)   c                 ó6   — | j                              |¦  «        S )zuReturn True if y is in the valid range of y_pred.

        Parameters
        ----------
        y : ndarray
        )r%   r,   r-   s     r'   Úin_y_pred_rangezBaseLoss.in_y_pred_range”   r0   r)   r   c                 óÒ   — |€t          j        |¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }| j                             |||||¬¦  «         |S )aJ  Compute the pointwise loss value for each input.

        Parameters
        ----------
        y_true : C-contiguous array of shape (n_samples,)
            Observed, true target values.
        raw_prediction : C-contiguous array of shape (n_samples,) or array of             shape (n_samples, n_classes)
            Raw prediction values (in link space).
        sample_weight : None or C-contiguous array of shape (n_samples,)
            Sample weights.
        loss_out : None or C-contiguous array of shape (n_samples,)
            A location into which the result is stored. If None, a new array
            might be created.
        n_threads : int, default=1
            Might use openmp thread parallelism.

        Returns
        -------
        loss : array of shape (n_samples,)
            Element-wise loss function.
        Nr   r   ©Úy_trueÚraw_predictionÚsample_weightÚloss_outÚ	n_threads)r"   Ú
empty_likeÚndimÚshapeÚsqueezer   Úloss)r&   r5   r6   r7   r8   r9   s         r'   r>   zBaseLoss.loss�   s   € ð< ÐÝ”} VÑ,Ô,ˆHàÔ !Ò#Ð#¨Ô(<¸QÔ(?À1Ò(DÐ(DØ+×3Ò3°AÑ6Ô6ˆNàŒ
�ŠØØ)Ø'ØØð 	ñ 	
ô 	
ð 	
ð ˆr)   c                 óÚ  — |€G|€)t          j        |¦  «        }t          j        |¦  «        }n9t          j        ||j        ¬¦  «        }n|€t          j        ||j        ¬¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }| j                             ||||||¬¦  «         ||fS )a¯  Compute loss and gradient w.r.t. raw_prediction for each input.

        Parameters
        ----------
        y_true : C-contiguous array of shape (n_samples,)
            Observed, true target values.
        raw_prediction : C-contiguous array of shape (n_samples,) or array of             shape (n_samples, n_classes)
            Raw prediction values (in link space).
        sample_weight : None or C-contiguous array of shape (n_samples,)
            Sample weights.
        loss_out : None or C-contiguous array of shape (n_samples,)
            A location into which the loss is stored. If None, a new array
            might be created.
        gradient_out : None or C-contiguous array of shape (n_samples,) or array             of shape (n_samples, n_classes)
            A location into which the gradient is stored. If None, a new array
            might be created.
        n_threads : int, default=1
            Might use openmp thread parallelism.

        Returns
        -------
        loss : array of shape (n_samples,)
            Element-wise loss function.

        gradient : array of shape (n_samples,) or (n_samples, n_classes)
            Element-wise gradients.
        N©Údtyper   r   )r5   r6   r7   r8   Úgradient_outr9   )r"   r:   rA   r;   r<   r=   r   Úloss_gradient)r&   r5   r6   r7   r8   rB   r9   s          r'   rC   zBaseLoss.loss_gradientÊ   s  € ðL ÐØÐ#Ýœ=¨Ñ0Ô0�Ý!œ}¨^Ñ<Ô<��åœ=¨°|Ô7IÐJÑJÔJ��ØÐ!Ýœ=¨¸x¼~ÐNÑNÔNˆLð Ô !Ò#Ð#¨Ô(<¸QÔ(?À1Ò(DÐ(DØ+×3Ò3°AÑ6Ô6ˆNØÔ Ò!Ð! lÔ&8¸Ô&;¸qÒ&@Ð&@Ø'×/Ò/°Ñ2Ô2ˆLàŒ
× Ò ØØ)Ø'ØØ%Øð 	!ñ 	
ô 	
ð 	
ð ˜Ð%Ð%r)   c                 ó4  — |€t          j        |¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }| j                             |||||¬¦  «         |S )aª  Compute gradient of loss w.r.t raw_prediction for each input.

        Parameters
        ----------
        y_true : C-contiguous array of shape (n_samples,)
            Observed, true target values.
        raw_prediction : C-contiguous array of shape (n_samples,) or array of             shape (n_samples, n_classes)
            Raw prediction values (in link space).
        sample_weight : None or C-contiguous array of shape (n_samples,)
            Sample weights.
        gradient_out : None or C-contiguous array of shape (n_samples,) or array             of shape (n_samples, n_classes)
            A location into which the result is stored. If None, a new array
            might be created.
        n_threads : int, default=1
            Might use openmp thread parallelism.

        Returns
        -------
        gradient : array of shape (n_samples,) or (n_samples, n_classes)
            Element-wise gradients.
        Nr   r   )r5   r6   r7   rB   r9   )r"   r:   r;   r<   r=   r   Úgradient)r&   r5   r6   r7   rB   r9   s         r'   rE   zBaseLoss.gradient	  s·   € ð> ÐÝœ=¨Ñ8Ô8ˆLð Ô !Ò#Ð#¨Ô(<¸QÔ(?À1Ò(DÐ(DØ+×3Ò3°AÑ6Ô6ˆNØÔ Ò!Ð! lÔ&8¸Ô&;¸qÒ&@Ð&@Ø'×/Ò/°Ñ2Ô2ˆLàŒ
×ÒØØ)Ø'Ø%Øð 	ñ 	
ô 	
ð 	
ð Ðr)   c                 ó   — |€@|€)t          j        |¦  «        }t          j        |¦  «        }n+t          j        |¦  «        }n|€t          j        |¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }|j        dk    r&|j        d         dk    r|                     d¦  «        }| j                             ||||||¬¦  «         ||fS )aÿ  Compute gradient and hessian of loss w.r.t raw_prediction.

        Parameters
        ----------
        y_true : C-contiguous array of shape (n_samples,)
            Observed, true target values.
        raw_prediction : C-contiguous array of shape (n_samples,) or array of             shape (n_samples, n_classes)
            Raw prediction values (in link space).
        sample_weight : None or C-contiguous array of shape (n_samples,)
            Sample weights.
        gradient_out : None or C-contiguous array of shape (n_samples,) or array             of shape (n_samples, n_classes)
            A location into which the gradient is stored. If None, a new array
            might be created.
        hessian_out : None or C-contiguous array of shape (n_samples,) or array             of shape (n_samples, n_classes)
            A location into which the hessian is stored. If None, a new array
            might be created.
        n_threads : int, default=1
            Might use openmp thread parallelism.

        Returns
        -------
        gradient : arrays of shape (n_samples,) or (n_samples, n_classes)
            Element-wise gradients.

        hessian : arrays of shape (n_samples,) or (n_samples, n_classes)
            Element-wise hessians.
        Nr   r   )r5   r6   r7   rB   Úhessian_outr9   )r"   r:   r;   r<   r=   r   Úgradient_hessian)r&   r5   r6   r7   rB   rG   r9   s          r'   rH   zBaseLoss.gradient_hessian:  s0  € ðN ÐØÐ"Ý!œ}¨^Ñ<Ô<�Ý œm¨NÑ;Ô;��å!œ}¨[Ñ9Ô9��ØÐ Ýœ-¨Ñ5Ô5ˆKð Ô !Ò#Ð#¨Ô(<¸QÔ(?À1Ò(DÐ(DØ+×3Ò3°AÑ6Ô6ˆNØÔ Ò!Ð! lÔ&8¸Ô&;¸qÒ&@Ð&@Ø'×/Ò/°Ñ2Ô2ˆLØÔ˜qÒ Ð  [Ô%6°qÔ%9¸QÒ%>Ð%>Ø%×-Ò-¨aÑ0Ô0ˆKàŒ
×#Ò#ØØ)Ø'Ø%Ø#Øð 	$ñ 	
ô 	
ð 	
ð ˜[Ð(Ð(r)   c           	      ó^   — t          j        |                      ||dd|¬¦  «        |¬¦  «        S )a{  Compute the weighted average loss.

        Parameters
        ----------
        y_true : C-contiguous array of shape (n_samples,)
            Observed, true target values.
        raw_prediction : C-contiguous array of shape (n_samples,) or array of             shape (n_samples, n_classes)
            Raw prediction values (in link space).
        sample_weight : None or C-contiguous array of shape (n_samples,)
            Sample weights.
        n_threads : int, default=1
            Might use openmp thread parallelism.

        Returns
        -------
        loss : float
            Mean or averaged loss function.
        Nr4   ©Úweights)r"   Úaverager>   )r&   r5   r6   r7   r9   s        r'   Ú__call__zBaseLoss.__call__|  sG   € õ( ŒzØ�IŠIØØ-Ø"ØØ#ð ñ ô ð "ð	
ñ 	
ô 	
ð 		
r)   c                 ó   — t          j        ||d¬¦  «        }dt          j        |j        ¦  «        j        z  }| j        j        t           j         k    rd}n(| j        j        r| j        j        }n| j        j        |z   }| j        j	        t           j        k    rd}n(| j        j
        r| j        j	        }n| j        j	        |z
  }|€|€| j                             |¦  «        S | j                             t          j        |||¦  «        ¦  «        S )a#  Compute raw_prediction of an intercept-only model.

        This can be used as initial estimates of predictions, i.e. before the
        first iteration in fit.

        Parameters
        ----------
        y_true : array-like of shape (n_samples,)
            Observed, true target values.
        sample_weight : None or array of shape (n_samples,)
            Sample weights.

        Returns
        -------
        raw_prediction : numpy scalar or array of shape (n_classes,)
            Raw predictions of an intercept-only model.
        r   ©rK   Úaxisé
   N)r"   rL   ÚfinforA   Úepsr%   Úlowr#   Úlow_inclusiveÚhighÚhigh_inclusiver   Úclip)r&   r5   r7   Úy_predrS   Úa_minÚa_maxs          r'   Úfit_intercept_onlyzBaseLoss.fit_intercept_only›  sþ   € õ( ”˜F¨MÀÐBÑBÔBˆØ•2”8˜FœLÑ)Ô)Ô-Ñ-ˆàÔÔ#­¬ wÒ.Ð.ØˆEˆEØÔ!Ô/ð 	3ØÔ(Ô,ˆEˆEàÔ(Ô,¨sÑ2ˆEàÔÔ$­¬Ò.Ð.ØˆEˆEØÔ!Ô0ð 	4ØÔ(Ô-ˆEˆEàÔ(Ô-°Ñ3ˆEàˆ=˜U˜]Ø”9—>’> &Ñ)Ô)Ð)à”9—>’>¥"¤'¨&°%¸Ñ"?Ô"?Ñ@Ô@Ð@r)   c                 ó*   — t          j        |¦  «        S )zpCalculate term dropped in loss.

        With this term added, the loss of perfect predictions is zero.
        )r"   Ú
zeros_like©r&   r5   r7   s      r'   Úconstant_to_optimal_zeroz!BaseLoss.constant_to_optimal_zeroÅ  s   € õ
 Œ}˜VÑ$Ô$Ð$r)   ÚFc                 ó$  — |t           j        t           j        fvrt          d|› d�¦  «        ‚| j        r
|| j        f}n|f}t          j        |||¬¦  «        }| j        rt          j        d|¬¦  «        }nt          j        |||¬¦  «        }||fS )au  Initialize arrays for gradients and hessians.

        Unless hessians are constant, arrays are initialized with undefined values.

        Parameters
        ----------
        n_samples : int
            The number of samples, usually passed to `fit()`.
        dtype : {np.float64, np.float32}, default=np.float64
            The dtype of the arrays gradient and hessian.
        order : {'C', 'F'}, default='F'
            Order of the arrays gradient and hessian. The default 'F' makes the arrays
            contiguous along samples.

        Returns
        -------
        gradient : C-contiguous array of shape (n_samples,) or array of shape             (n_samples, n_classes)
            Empty array (allocated but not initialized) to be used as argument
            gradient_out.
        hessian : C-contiguous array of shape (n_samples,), array of shape
            (n_samples, n_classes) or shape (1,)
            Empty (allocated but not initialized) array to be used as argument
            hessian_out.
            If constant_hessian is True (e.g. `HalfSquaredError`), the array is
            initialized to ``1``.
        zCValid options for 'dtype' are np.float32 and np.float64. Got dtype=z	 instead.)r<   rA   Úorder)r   )r<   rA   )	r"   Úfloat32Úfloat64Ú
ValueErrorÚis_multiclassr!   Úemptyr    Úones)r&   Ú	n_samplesrA   rc   r<   rE   Úhessians          r'   Úinit_gradient_and_hessianz"BaseLoss.init_gradient_and_hessianÌ  s¾   € ð8 �œ¥R¤ZÐ0Ð0Ð0Ýð.Ø"ð.ð .ð .ñô ð ð
 Ôð 	!Ø ¤Ð/ˆEˆEà�LˆEÝ”8 %¨u¸EÐBÑBÔBˆàÔ ð 	Fõ
 ”g D°Ð6Ñ6Ô6ˆGˆGå”h U°%¸uÐEÑEÔEˆGà˜Ð Ð r)   ©N)NNr   ©NNNr   ©Nr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdifferentiableÚneed_update_leaves_valuesrg   r(   r/   r2   r>   rC   rE   rH   rM   r\   r`   r"   re   rl   © r)   r'   r   r   C   sK  € € € € € ð/ð /ðt €NØ %ÐØ€Mð9ð 9ð 9ð 9ð0ð 0ð 0ð0ð 0ð 0ð ØØð+ð +ð +ð +ðb ØØØð=&ð =&ð =&ð =&ðF ØØð/ð /ð /ð /ðj ØØØð@)ð @)ð @)ð @)ðD
ð 
ð 
ð 
ð>(Að (Að (Að (AðT%ð %ð %ð %ð :<¼È3ð 1!ð 1!ð 1!ð 1!ð 1!ð 1!r)   r   c                   ó$   ‡ — e Zd ZdZdˆ fd„	Zˆ xZS )ÚHalfSquaredErroraÜ  Half squared error with identity link, for regression.

    Domain:
    y_true and y_pred all real numbers

    Link:
    y_pred = raw_prediction

    For a given sample x_i, half squared error is defined as::

        loss(x_i) = 0.5 * (y_true_i - raw_prediction_i)**2

    The factor of 0.5 simplifies the computation of gradients and results in a
    unit hessian (and is consistent with what is done in LightGBM). It is also
    half the Normal distribution deviance.
    Nc                 ó�   •— t          ¦   «                              t          ¦   «         t          ¦   «         ¬¦  «         |d u | _        d S )N©r   r   )Úsuperr(   r   r   r    ©r&   r7   Ú	__class__s     €r'   r(   zHalfSquaredError.__init__  s>   ø€ Ý‰Œ×ÒÕ1Ñ3Ô3½,¹.¼.ÐÑIÔIÐIØ -°Ð 5ˆÔÐÐr)   rm   ©rp   rq   rr   rs   r(   Ú__classcell__©r}   s   @r'   rx   rx     sG   ø€ € € € € ðð ð"6ð 6ð 6ð 6ð 6ð 6ð 6ð 6ð 6ð 6r)   rx   c                   ó4   ‡ — e Zd ZdZdZdZdˆ fd„	Zdd„Zˆ xZS )ÚAbsoluteErroraÖ  Absolute error with identity link, for regression.

    Domain:
    y_true and y_pred all real numbers

    Link:
    y_pred = raw_prediction

    For a given sample x_i, the absolute error is defined as::

        loss(x_i) = |y_true_i - raw_prediction_i|

    Note that the exact hessian = 0 almost everywhere (except at one point, therefore
    differentiable = False). Optimization routines like in HGBT, however, need a
    hessian > 0. Therefore, we assign 1.
    FTNc                 óž   •— t          ¦   «                              t          ¦   «         t          ¦   «         ¬¦  «         d| _        |d u | _        d S )Nrz   T)r{   r(   r	   r   r   r    r|   s     €r'   r(   zAbsoluteError.__init__0  sE   ø€ Ý‰Œ×Ò�Ñ0Ô0µ|±~´~ÐÑFÔFÐFØ"ˆÔØ -°Ð 5ˆÔÐÐr)   c                 óT   — |€t          j        |d¬¦  «        S t          ||d¦  «        S )ú•Compute raw_prediction of an intercept-only model.

        This is the weighted median of the target, i.e. over the samples
        axis=0.
        Nr   ©rP   é2   )r"   Úmedianr   r_   s      r'   r\   z AbsoluteError.fit_intercept_only5  s1   € ð Ð Ý”9˜V¨!Ð,Ñ,Ô,Ð,å'¨°¸rÑBÔBÐBr)   rm   ©	rp   rq   rr   rs   rt   ru   r(   r\   r   r€   s   @r'   r‚   r‚     sp   ø€ € € € € ðð ð" €NØ $Ðð6ð 6ð 6ð 6ð 6ð 6ð
	Cð 	Cð 	Cð 	Cð 	Cð 	Cð 	Cð 	Cr)   r‚   c                   ó4   ‡ — e Zd ZdZdZdZdˆ fd„	Zd	d„Zˆ xZS )
ÚPinballLossa  Quantile loss aka pinball loss, for regression.

    Domain:
    y_true and y_pred all real numbers
    quantile in (0, 1)

    Link:
    y_pred = raw_prediction

    For a given sample x_i, the pinball loss is defined as::

        loss(x_i) = rho_{quantile}(y_true_i - raw_prediction_i)

        rho_{quantile}(u) = u * (quantile - 1_{u<0})
                          = -u *(1 - quantile)  if u < 0
                             u * quantile       if u >= 0

    Note: 2 * PinballLoss(quantile=0.5) equals AbsoluteError().

    Note that the exact hessian = 0 almost everywhere (except at one point, therefore
    differentiable = False). Optimization routines like in HGBT, however, need a
    hessian > 0. Therefore, we assign 1.

    Additional Attributes
    ---------------------
    quantile : float
        The quantile level of the quantile to be estimated. Must be in range (0, 1).
    FTNç      à?c                 óú   •— t          |dt          j        ddd¬¦  «         t          ¦   «                              t          t          |¦  «        ¬¦  «        t          ¦   «         ¬¦  «         d| _        |d u | _	        d S )	NÚquantiler   r   Úneither©Útarget_typeÚmin_valÚmax_valÚinclude_boundaries)rŽ   rz   T)
r   ÚnumbersÚRealr{   r(   r   Úfloatr   r   r    )r&   r7   rŽ   r}   s      €r'   r(   zPinballLoss.__init__b  s‰   ø€ ÝØØÝœØØØ(ð	
ñ 	
ô 	
ð 	
õ 	‰Œ×ÒÝ­¨x©¬Ð9Ñ9Ô9Ý‘”ð 	ñ 	
ô 	
ð 	
ð #ˆÔØ -°Ð 5ˆÔÐÐr)   c                 óŠ   — |€$t          j        |d| j        j        z  d¬¦  «        S t	          ||d| j        j        z  ¦  «        S )r…   Néd   r   r†   )r"   Ú
percentiler   rŽ   r   r_   s      r'   r\   zPinballLoss.fit_intercept_onlyr  sN   € ð Ð Ý”= ¨¨t¬zÔ/BÑ)BÈÐKÑKÔKÐKå'Ø˜ s¨T¬ZÔ-@Ñ'@ñô ð r)   )NrŒ   rm   r‰   r€   s   @r'   r‹   r‹   A  sh   ø€ € € € € ðð ð: €NØ $Ðð6ð 6ð 6ð 6ð 6ð 6ð ð ð ð ð ð ð ð r)   r‹   c                   ó4   ‡ — e Zd ZdZdZdZd	ˆ fd„	Zd
d„Zˆ xZS )Ú	HuberLossaê  Huber loss, for regression.

    Domain:
    y_true and y_pred all real numbers
    quantile in (0, 1)

    Link:
    y_pred = raw_prediction

    For a given sample x_i, the Huber loss is defined as::

        loss(x_i) = 1/2 * abserr**2            if abserr <= delta
                    delta * (abserr - delta/2) if abserr > delta

        abserr = |y_true_i - raw_prediction_i|
        delta = quantile(abserr, self.quantile)

    Note: HuberLoss(quantile=1) equals HalfSquaredError and HuberLoss(quantile=0)
    equals delta * (AbsoluteError() - delta/2).

    Additional Attributes
    ---------------------
    quantile : float
        The quantile level which defines the breaking point `delta` to distinguish
        between absolute error and squared error. Must be in range (0, 1).

     Reference
    ---------
    .. [1] Friedman, J.H. (2001). :doi:`Greedy function approximation: A gradient
      boosting machine <10.1214/aos/1013203451>`.
      Annals of Statistics, 29, 1189-1232.
    FTNçÍÌÌÌÌÌì?rŒ   c                 ó  •— t          |dt          j        ddd¬¦  «         || _        t	          ¦   «                              t          t          |¦  «        ¬¦  «        t          ¦   «         ¬¦  «         d| _	        d	| _
        d S )
NrŽ   r   r   r�   r�   )Údeltarz   TF)r   r•   r–   rŽ   r{   r(   r   r—   r   r   r    )r&   r7   rŽ   rŸ   r}   s       €r'   r(   zHuberLoss.__init__¥  s‹   ø€ ÝØØÝœØØØ(ð	
ñ 	
ô 	
ð 	
ð !ˆŒÝ‰Œ×ÒÝ¥E¨%¡L¤LÐ1Ñ1Ô1Ý‘”ð 	ñ 	
ô 	
ð 	
ð #ˆÔØ %ˆÔÐÐr)   c                 ó   — |€t          j        |dd¬¦  «        }nt          ||d¦  «        }||z
  }t          j        |¦  «        t          j        | j        j        t          j        |¦  «        ¦  «        z  }|t          j        ||¬¦  «        z   S )r…   Nr‡   r   r†   rJ   )	r"   rš   r   ÚsignÚminimumr   rŸ   ÚabsrL   )r&   r5   r7   rˆ   ÚdiffÚterms         r'   r\   zHuberLoss.fit_intercept_only¶  s�   € ð Ð Ý”] 6¨2°AÐ6Ñ6Ô6ˆFˆFå)¨&°-ÀÑDÔDˆFØ˜‰ˆÝŒw�t‰}Œ}�rœz¨$¬*Ô*:½B¼FÀ4¹L¼LÑIÔIÑIˆØ�œ
 4°Ð?Ñ?Ô?Ñ?Ð?r)   )Nr�   rŒ   rm   r‰   r€   s   @r'   rœ   rœ   €  sq   ø€ € € € € ðð ðB €NØ $Ðð&ð &ð &ð &ð &ð &ð"@ð @ð @ð @ð @ð @ð @ð @r)   rœ   c                   ó,   ‡ — e Zd ZdZdˆ fd„	Zdd„Zˆ xZS )ÚHalfPoissonLossaƒ  Half Poisson deviance loss with log-link, for regression.

    Domain:
    y_true in non-negative real numbers
    y_pred in positive real numbers

    Link:
    y_pred = exp(raw_prediction)

    For a given sample x_i, half the Poisson deviance is defined as::

        loss(x_i) = y_true_i * log(y_true_i/exp(raw_prediction_i))
                    - y_true_i + exp(raw_prediction_i)

    Half the Poisson deviance is actually the negative log-likelihood up to
    constant terms (not involving raw_prediction) and simplifies the
    computation of the gradients.
    We also skip the constant term `y_true_i * log(y_true_i) - y_true_i`.
    Nc                 óÀ   •— t          ¦   «                              t          ¦   «         t          ¦   «         ¬¦  «         t	          dt
          j        dd¦  «        | _        d S )Nrz   r   TF)r{   r(   r   r   r   r"   r#   r$   r|   s     €r'   r(   zHalfPoissonLoss.__init__Þ  sI   ø€ Ý‰Œ×ÒÕ0Ñ2Ô2½¹¼ÐÑCÔCÐCÝ'¨­2¬6°4¸Ñ?Ô?ˆÔÐÐr)   c                 ó:   — t          ||¦  «        |z
  }|�||z  }|S rm   r   ©r&   r5   r7   r¥   s       r'   r`   z(HalfPoissonLoss.constant_to_optimal_zeroâ  s+   € Ý�V˜VÑ$Ô$ vÑ-ˆØÐ$Ø�MÑ!ˆDØˆr)   rm   ©rp   rq   rr   rs   r(   r`   r   r€   s   @r'   r§   r§   É  sa   ø€ € € € € ðð ð(@ð @ð @ð @ð @ð @ðð ð ð ð ð ð ð r)   r§   c                   ó,   ‡ — e Zd ZdZdˆ fd„	Zdd„Zˆ xZS )ÚHalfGammaLossaV  Half Gamma deviance loss with log-link, for regression.

    Domain:
    y_true and y_pred in positive real numbers

    Link:
    y_pred = exp(raw_prediction)

    For a given sample x_i, half Gamma deviance loss is defined as::

        loss(x_i) = log(exp(raw_prediction_i)/y_true_i)
                    + y_true/exp(raw_prediction_i) - 1

    Half the Gamma deviance is actually proportional to the negative log-
    likelihood up to constant terms (not involving raw_prediction) and
    simplifies the computation of the gradients.
    We also skip the constant term `-log(y_true_i) - 1`.
    Nc                 óÀ   •— t          ¦   «                              t          ¦   «         t          ¦   «         ¬¦  «         t	          dt
          j        dd¦  «        | _        d S )Nrz   r   F)r{   r(   r   r   r   r"   r#   r$   r|   s     €r'   r(   zHalfGammaLoss.__init__ý  sH   ø€ Ý‰Œ×Ò�Ñ0Ô0µw±y´yÐÑAÔAÐAÝ'¨­2¬6°5¸%Ñ@Ô@ˆÔÐÐr)   c                 óD   — t          j        |¦  «         dz
  }|�||z  }|S ro   )r"   Úlogrª   s       r'   r`   z&HalfGammaLoss.constant_to_optimal_zero  s+   € Ý”�v‘”ˆ Ñ"ˆØÐ$Ø�MÑ!ˆDØˆr)   rm   r«   r€   s   @r'   r­   r­   é  sa   ø€ € € € € ðð ð&Að Að Að Að Að Aðð ð ð ð ð ð ð r)   r­   c                   ó,   ‡ — e Zd ZdZdˆ fd„	Zdd„Zˆ xZS )ÚHalfTweedieLossaÿ  Half Tweedie deviance loss with log-link, for regression.

    Domain:
    y_true in real numbers for power <= 0
    y_true in non-negative real numbers for 0 < power < 2
    y_true in positive real numbers for 2 <= power
    y_pred in positive real numbers
    power in real numbers

    Link:
    y_pred = exp(raw_prediction)

    For a given sample x_i, half Tweedie deviance loss with p=power is defined
    as::

        loss(x_i) = max(y_true_i, 0)**(2-p) / (1-p) / (2-p)
                    - y_true_i * exp(raw_prediction_i)**(1-p) / (1-p)
                    + exp(raw_prediction_i)**(2-p) / (2-p)

    Taking the limits for p=0, 1, 2 gives HalfSquaredError with a log link,
    HalfPoissonLoss and HalfGammaLoss.

    We also skip constant terms, but those are different for p=0, 1, 2.
    Therefore, the loss is not continuous in `power`.

    Note furthermore that although no Tweedie distribution exists for
    0 < power < 1, it still gives a strictly consistent scoring function for
    the expectation.
    Nç      ø?c                 óÀ  •— t          ¦   «                              t          t          |¦  «        ¬¦  «        t	          ¦   «         ¬¦  «         | j        j        dk    r.t          t          j	         t          j	        dd¦  «        | _
        d S | j        j        dk     r#t          dt          j	        dd¦  «        | _
        d S t          dt          j	        dd¦  «        | _
        d S ©N)Úpowerrz   r   Fr   T)r{   r(   r   r—   r   r   r¶   r   r"   r#   r$   ©r&   r7   r¶   r}   s      €r'   r(   zHalfTweedieLoss.__init__'  s¿   ø€ Ý‰Œ×ÒÝ#­%°©,¬,Ð7Ñ7Ô7Ý‘”ð 	ñ 	
ô 	
ð 	
ð Œ:Ô˜qÒ Ð Ý#+­R¬V¨GµR´V¸UÀEÑ#JÔ#JˆDÔ Ð Ð ØŒZÔ Ò!Ð!Ý#+¨A­r¬v°t¸UÑ#CÔ#CˆDÔ Ð Ð å#+¨A­r¬v°u¸eÑ#DÔ#DˆDÔ Ð Ð r)   c                 óÌ  — | j         j        dk    r#t          ¦   «                              ||¬¦  «        S | j         j        dk    r#t	          ¦   «                              ||¬¦  «        S | j         j        dk    r#t          ¦   «                              ||¬¦  «        S | j         j        }t          j        t          j        |d¦  «        d|z
  ¦  «        d|z
  z  d|z
  z  }|�||z  }|S )Nr   )r5   r7   r   r   )r   r¶   rx   r`   r§   r­   r"   Úmaximum)r&   r5   r7   Úpr¥   s        r'   r`   z(HalfTweedieLoss.constant_to_optimal_zero3  s   € ØŒ:Ô˜qÒ Ð Ý#Ñ%Ô%×>Ò>Ø¨]ð ?ñ ô ð ð ŒZÔ Ò"Ð"Ý"Ñ$Ô$×=Ò=Ø¨]ð >ñ ô ð ð ŒZÔ Ò"Ð"Ý ‘?”?×;Ò;Ø¨]ð <ñ ô ð ð ”
Ô ˆAÝ”8�BœJ v¨qÑ1Ô1°1°q±5Ñ9Ô9¸QÀ¹UÑCÀqÈ1ÁuÑMˆDØÐ(Ø˜Ñ%�ØˆKr)   ©Nr³   rm   r«   r€   s   @r'   r²   r²     sa   ø€ € € € € ðð ð<
Eð 
Eð 
Eð 
Eð 
Eð 
Eðð ð ð ð ð ð ð r)   r²   c                   ó$   ‡ — e Zd ZdZdˆ fd„	Zˆ xZS )ÚHalfTweedieLossIdentityan  Half Tweedie deviance loss with identity link, for regression.

    Domain:
    y_true in real numbers for power <= 0
    y_true in non-negative real numbers for 0 < power < 2
    y_true in positive real numbers for 2 <= power
    y_pred in positive real numbers for power != 0
    y_pred in real numbers for power = 0
    power in real numbers

    Link:
    y_pred = raw_prediction

    For a given sample x_i, half Tweedie deviance loss with p=power is defined
    as::

        loss(x_i) = max(y_true_i, 0)**(2-p) / (1-p) / (2-p)
                    - y_true_i * raw_prediction_i**(1-p) / (1-p)
                    + raw_prediction_i**(2-p) / (2-p)

    Note that the minimum value of this loss is 0.

    Note furthermore that although no Tweedie distribution exists for
    0 < power < 1, it still gives a strictly consistent scoring function for
    the expectation.
    Nr³   c                 óz  •— t          ¦   «                              t          t          |¦  «        ¬¦  «        t	          ¦   «         ¬¦  «         | j        j        dk    r-t          t          j	         t          j	        dd¦  «        | _
        nS| j        j        dk     r"t          dt          j	        dd¦  «        | _
        n!t          dt          j	        dd¦  «        | _
        | j        j        dk    r.t          t          j	         t          j	        dd¦  «        | _        d S t          dt          j	        dd¦  «        | _        d S rµ   )r{   r(   r   r—   r   r   r¶   r   r"   r#   r$   r%   r·   s      €r'   r(   z HalfTweedieLossIdentity.__init__d  s  ø€ Ý‰Œ×ÒÝ+µ%¸±,´,Ð?Ñ?Ô?Ý‘”ð 	ñ 	
ô 	
ð 	
ð Œ:Ô˜qÒ Ð Ý#+­R¬V¨GµR´V¸UÀEÑ#JÔ#JˆDÔ Ð ØŒZÔ Ò!Ð!Ý#+¨A­r¬v°t¸UÑ#CÔ#CˆDÔ Ð å#+¨A­r¬v°u¸eÑ#DÔ#DˆDÔ àŒ:Ô˜qÒ Ð Ý#+­R¬V¨GµR´V¸UÀEÑ#JÔ#JˆDÔ Ð Ð å#+¨A­r¬v°u¸eÑ#DÔ#DˆDÔ Ð Ð r)   r»   r~   r€   s   @r'   r½   r½   H  sQ   ø€ € € € € ðð ð6Eð Eð Eð Eð Eð Eð Eð Eð Eð Er)   r½   c                   ó2   ‡ — e Zd ZdZdˆ fd„	Zdd„Zd„ Zˆ xZS )ÚHalfBinomialLossaY  Half Binomial deviance loss with logit link, for binary classification.

    This is also know as binary cross entropy, log-loss and logistic loss.

    Domain:
    y_true in [0, 1], i.e. regression on the unit interval
    y_pred in (0, 1), i.e. boundaries excluded

    Link:
    y_pred = expit(raw_prediction)

    For a given sample x_i, half Binomial deviance is defined as the negative
    log-likelihood of the Binomial/Bernoulli distribution and can be expressed
    as::

        loss(x_i) = log(1 + exp(raw_pred_i)) - y_true_i * raw_pred_i

    See The Elements of Statistical Learning, by Hastie, Tibshirani, Friedman,
    section 4.4.1 (about logistic regression).

    Note that the formulation works for classification, y = {0, 1}, as well as
    logistic regression, y = [0, 1].
    If you add `constant_to_optimal_zero` to the loss, you get half the
    Bernoulli/binomial deviance.

    More details: Inserting the predicted probability y_pred = expit(raw_prediction)
    in the loss gives the well known::

        loss(x_i) = - y_true_i * log(y_pred_i) - (1 - y_true_i) * log(1 - y_pred_i)
    Nc                 ó®   •— t          ¦   «                              t          ¦   «         t          ¦   «         d¬¦  «         t	          dddd¦  «        | _        d S ©Nr   ©r   r   r!   r   r   T)r{   r(   r   r   r   r$   r|   s     €r'   r(   zHalfBinomialLoss.__init__–  sU   ø€ Ý‰Œ×ÒÝ$Ñ&Ô&Ý‘”Øð 	ñ 	
ô 	
ð 	
õ
  (¨¨1¨d°DÑ9Ô9ˆÔÐÐr)   c                 ób   — t          ||¦  «        t          d|z
  d|z
  ¦  «        z   }|�||z  }|S ro   r   rª   s       r'   r`   z)HalfBinomialLoss.constant_to_optimal_zerož  s=   € å�V˜VÑ$Ô$¥u¨Q°©Z¸¸V¹Ñ'DÔ'DÑDˆØÐ$Ø�MÑ!ˆDØˆr)   c                 ó&  — |j         dk    r&|j        d         dk    r|                     d¦  «        }t          j        |j        d         df|j        ¬¦  «        }| j                             |¦  «        |dd…df<   d|dd…df         z
  |dd…df<   |S ©a=  Predict probabilities.

        Parameters
        ----------
        raw_prediction : array of shape (n_samples,) or (n_samples, 1)
            Raw prediction values (in link space).

        Returns
        -------
        proba : array of shape (n_samples, 2)
            Element-wise class probabilities.
        r   r   r   r@   N©r;   r<   r=   r"   rh   rA   r   Úinverse©r&   r6   Úprobas      r'   Úpredict_probazHalfBinomialLoss.predict_proba¥  ó¢   € ð Ô !Ò#Ð#¨Ô(<¸QÔ(?À1Ò(DÐ(DØ+×3Ò3°AÑ6Ô6ˆNÝ”˜.Ô.¨qÔ1°1Ð5¸^Ô=QÐRÑRÔRˆØ”i×'Ò'¨Ñ7Ô7ˆˆaˆaˆa�ˆd‰Ø˜%    1 œ+‘oˆˆaˆaˆa�ˆd‰Øˆr)   rm   ©rp   rq   rr   rs   r(   r`   rË   r   r€   s   @r'   rÀ   rÀ   v  sj   ø€ € € € € ðð ð>:ð :ð :ð :ð :ð :ðð ð ð ðð ð ð ð ð ð r)   rÀ   c                   óL   ‡ — e Zd ZdZdZdˆ fd„	Zd„ Zdd„Zd„ Z	 	 	 	 dd
„Z	ˆ xZ
S )ÚHalfMultinomialLossa”  Categorical cross-entropy loss, for multiclass classification.

    Domain:
    y_true in {0, 1, 2, 3, .., n_classes - 1}
    y_pred has n_classes elements, each element in (0, 1)

    Link:
    y_pred = softmax(raw_prediction)

    Note: We assume y_true to be already label encoded. The inverse link is
    softmax. But the full link function is the symmetric multinomial logit
    function.

    For a given sample x_i, the categorical cross-entropy loss is defined as
    the negative log-likelihood of the multinomial distribution, it
    generalizes the binary cross-entropy to more than 2 classes::

        loss_i = log(sum(exp(raw_pred_{i, k}), k=0..n_classes-1))
                - sum(y_true_{i, k} * raw_pred_{i, k}, k=0..n_classes-1)

    See [1].

    Note that for the hessian, we calculate only the diagonal part in the
    classes: If the full hessian for classes k and l and sample i is H_i_k_l,
    we calculate H_i_k_k, i.e. k=l.

    Reference
    ---------
    .. [1] :arxiv:`Simon, Noah, J. Friedman and T. Hastie.
        "A Blockwise Descent Algorithm for Group-penalized Multiresponse and
        Multinomial Regression".
        <1311.6529>`
    TNé   c                 óð   •— t          ¦   «                              t          ¦   «         t          ¦   «         |¬¦  «         t	          dt
          j        dd¦  «        | _        t	          dddd¦  «        | _        d S )NrÃ   r   TFr   )	r{   r(   r   r   r   r"   r#   r$   r%   )r&   r7   r!   r}   s      €r'   r(   zHalfMultinomialLoss.__init__à  so   ø€ Ý‰Œ×ÒÝ'Ñ)Ô)Ý!Ñ#Ô#Øð 	ñ 	
ô 	
ð 	
õ
  (¨­2¬6°4¸Ñ?Ô?ˆÔÝ'¨¨1¨e°UÑ;Ô;ˆÔÐÐr)   c                 ó–   — | j                              |¦  «        o/t          j        |                     t
          ¦  «        |k    ¦  «        S r+   )r$   r,   r"   ÚallÚastypeÚintr-   s     r'   r/   z#HalfMultinomialLoss.in_y_true_rangeé  s9   € ð Ô#×,Ò,¨QÑ/Ô/ÐNµB´F¸1¿8º8ÅC¹=¼=ÈAÒ;MÑ4NÔ4NÐNr)   c                 óš  — t          j        | j        |j        ¬¦  «        }t          j        |j        ¦  «        j        }t          | j        ¦  «        D ]B}t          j        ||k    |d¬¦  «        ||<   t          j        ||         |d|z
  ¦  «        ||<   ŒC| j	         	                    |ddd…f         ¦  «         
                    d¦  «        S )z¥Compute raw_prediction of an intercept-only model.

        This is the softmax of the weighted average of the target, i.e. over
        the samples axis=0.
        r@   r   rO   r   Néÿÿÿÿ)r"   Úzerosr!   rA   rR   rS   ÚrangerL   rX   r   Úreshape)r&   r5   r7   ÚoutrS   Úks         r'   r\   z&HalfMultinomialLoss.fit_intercept_onlyò  s¶   € õ Œh�t”~¨V¬\Ð:Ñ:Ô:ˆÝŒh�v”|Ñ$Ô$Ô(ˆÝ�t”~Ñ&Ô&ð 	3ð 	3ˆAÝ”Z ¨!¢°]ÈÐKÑKÔKˆC�‰FÝ”W˜S œV S¨!¨c©'Ñ2Ô2ˆC�‰FˆFØŒy�~Š~˜c $¨¨¨ 'œlÑ+Ô+×3Ò3°BÑ7Ô7Ð7r)   c                 ó6   — | j                              |¦  «        S )a=  Predict probabilities.

        Parameters
        ----------
        raw_prediction : array of shape (n_samples, n_classes)
            Raw prediction values (in link space).

        Returns
        -------
        proba : array of shape (n_samples, n_classes)
            Element-wise class probabilities.
        )r   rÈ   )r&   r6   s     r'   rË   z!HalfMultinomialLoss.predict_probaÿ  s   € ð Œy× Ò  Ñ0Ô0Ð0r)   r   c                 óú   — |€@|€)t          j        |¦  «        }t          j        |¦  «        }n+t          j        |¦  «        }n|€t          j        |¦  «        }| j                             ||||||¬¦  «         ||fS )aK  Compute gradient and class probabilities fow raw_prediction.

        Parameters
        ----------
        y_true : C-contiguous array of shape (n_samples,)
            Observed, true target values.
        raw_prediction : array of shape (n_samples, n_classes)
            Raw prediction values (in link space).
        sample_weight : None or C-contiguous array of shape (n_samples,)
            Sample weights.
        gradient_out : None or array of shape (n_samples, n_classes)
            A location into which the gradient is stored. If None, a new array
            might be created.
        proba_out : None or array of shape (n_samples, n_classes)
            A location into which the class probabilities are stored. If None,
            a new array might be created.
        n_threads : int, default=1
            Might use openmp thread parallelism.

        Returns
        -------
        gradient : array of shape (n_samples, n_classes)
            Element-wise gradients.

        proba : array of shape (n_samples, n_classes)
            Element-wise class probabilities.
        N)r5   r6   r7   rB   Ú	proba_outr9   )r"   r:   r   Úgradient_proba)r&   r5   r6   r7   rB   rß   r9   s          r'   rà   z"HalfMultinomialLoss.gradient_proba  s•   € ðH ÐØÐ Ý!œ}¨^Ñ<Ô<�ÝœM¨.Ñ9Ô9�	�	å!œ}¨YÑ7Ô7��ØÐÝœ lÑ3Ô3ˆIàŒ
×!Ò!ØØ)Ø'Ø%ØØð 	"ñ 	
ô 	
ð 	
ð ˜YÐ&Ð&r)   )NrÐ   rm   rn   )rp   rq   rr   rs   rg   r(   r/   r\   rË   rà   r   r€   s   @r'   rÏ   rÏ   »  s¦   ø€ € € € € ð ð  ðD €Mð<ð <ð <ð <ð <ð <ðOð Oð Oð8ð 8ð 8ð 8ð1ð 1ð 1ð& ØØØð5'ð 5'ð 5'ð 5'ð 5'ð 5'ð 5'ð 5'r)   rÏ   c                   ó2   ‡ — e Zd ZdZdˆ fd„	Zdd„Zd„ Zˆ xZS )ÚExponentialLossa"  Exponential loss with (half) logit link, for binary classification.

    This is also know as boosting loss.

    Domain:
    y_true in [0, 1], i.e. regression on the unit interval
    y_pred in (0, 1), i.e. boundaries excluded

    Link:
    y_pred = expit(2 * raw_prediction)

    For a given sample x_i, the exponential loss is defined as::

        loss(x_i) = y_true_i * exp(-raw_pred_i)) + (1 - y_true_i) * exp(raw_pred_i)

    See:
    - J. Friedman, T. Hastie, R. Tibshirani.
      "Additive logistic regression: a statistical view of boosting (With discussion
      and a rejoinder by the authors)." Ann. Statist. 28 (2) 337 - 407, April 2000.
      https://doi.org/10.1214/aos/1016218223
    - A. Buja, W. Stuetzle, Y. Shen. (2005).
      "Loss Functions for Binary Class Probability Estimation and Classification:
      Structure and Applications."

    Note that the formulation works for classification, y = {0, 1}, as well as
    "exponential logistic" regression, y = [0, 1].
    Note that this is a proper scoring rule, but without it's canonical link.

    More details: Inserting the predicted probability
    y_pred = expit(2 * raw_prediction) in the loss gives::

        loss(x_i) = y_true_i * sqrt((1 - y_pred_i) / y_pred_i)
            + (1 - y_true_i) * sqrt(y_pred_i / (1 - y_pred_i))
    Nc                 ó®   •— t          ¦   «                              t          ¦   «         t          ¦   «         d¬¦  «         t	          dddd¦  «        | _        d S rÂ   )r{   r(   r
   r   r   r$   r|   s     €r'   r(   zExponentialLoss.__init__j  sU   ø€ Ý‰Œ×ÒÝ#Ñ%Ô%Ý‘”Øð 	ñ 	
ô 	
ð 	
õ
  (¨¨1¨d°DÑ9Ô9ˆÔÐÐr)   c                 óN   — dt          j        |d|z
  z  ¦  «        z  }|�||z  }|S )Néþÿÿÿr   )r"   Úsqrtrª   s       r'   r`   z(ExponentialLoss.constant_to_optimal_zeror  s4   € à•B”G˜F a¨&¡jÑ1Ñ2Ô2Ñ2ˆØÐ$Ø�MÑ!ˆDØˆr)   c                 ó&  — |j         dk    r&|j        d         dk    r|                     d¦  «        }t          j        |j        d         df|j        ¬¦  «        }| j                             |¦  «        |dd…df<   d|dd…df         z
  |dd…df<   |S rÆ   rÇ   rÉ   s      r'   rË   zExponentialLoss.predict_probay  rÌ   r)   rm   rÍ   r€   s   @r'   râ   râ   F  sk   ø€ € € € € ð!ð !ðF:ð :ð :ð :ð :ð :ðð ð ð ðð ð ð ð ð ð r)   râ   )
Úsquared_errorÚabsolute_errorÚpinball_lossÚ
huber_lossÚpoisson_lossÚ
gamma_lossÚtweedie_lossÚbinomial_lossÚmultinomial_lossÚexponential_loss)*rs   r•   Únumpyr"   Úscipy.specialr   Úutilsr   Úutils.statsr   Ú_lossr	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rx   r‚   r‹   rœ   r§   r­   r²   r½   rÀ   rÏ   râ   Ú_LOSSESrv   r)   r'   ú<module>rø      sž  ððð ð$ €€€à Ð Ð Ð Ø Ð Ð Ð Ð Ð à  Ð  Ð  Ð  Ð  Ð  Ø .Ð .Ð .Ð .Ð .Ð .ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð8z!ð z!ð z!ð z!ð z!ñ z!ô z!ð z!ðB6ð 6ð 6ð 6ð 6�xñ 6ô 6ð 6ð.#Cð #Cð #Cð #Cð #C�Hñ #Cô #Cð #CðL<ð <ð <ð <ð <�(ñ <ô <ð <ð~F@ð F@ð F@ð F@ð F@�ñ F@ô F@ð F@ðRð ð ð ð �hñ ô ð ð@ð ð ð ð �Hñ ô ð ð>=ð =ð =ð =ð =�hñ =ô =ð =ð@+Eð +Eð +Eð +Eð +E˜hñ +Eô +Eð +Eð\Bð Bð Bð Bð B�xñ Bô Bð BðJH'ð H'ð H'ð H'ð H'˜(ñ H'ô H'ð H'ðVFð Fð Fð Fð F�hñ Fô Fð FðT &Ø#ØØØ#ØØ#Ø%Ø+Ø'ðð €€€r)   