`L ie dZddlZddlZddlmZddlmZddlm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZdd lmZmZmZmZmZmZGd d ZGd d eZGddeZGddeZ GddeZ!GddeZ"GddeZ#GddeZ$GddeZ%GddeZ&GddeZ'Gd d!eZ(eee e!e"e#e$e&e'e(d" Z)y)#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. Nxlogy) check_scalar)_weighted_percentile) CyAbsoluteErrorCyExponentialLossCyHalfBinomialLossCyHalfGammaLossCyHalfMultinomialLossCyHalfPoissonLossCyHalfSquaredErrorCyHalfTweedieLossCyHalfTweedieLossIdentity CyHuberLoss CyPinballLoss) HalfLogitLink IdentityLinkInterval LogitLinkLogLinkMultinomialLogitceZdZdZdZdZdZddZdZdZ ddZ dd Z dd Z dd Z dd Zdd ZddZej$dfdZy)BaseLossaBase 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 jdd|_|jj|_ y)NF) closslinkapprox_hessianconstant_hessian n_classesrnpinfinterval_y_trueinterval_y_pred)selfrrr!s X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sklearn/_loss/loss.py__init__zBaseLoss.__init__sV  # %"'F#yy88c8|jj|SzuReturn True if y is in the valid range of y_true. Parameters ---------- y : ndarray )r$includesr&ys r'in_y_true_rangezBaseLoss.in_y_true_range##,,Q//r)c8|jj|S)zuReturn True if y is in the valid range of y_pred. Parameters ---------- y : ndarray )r%r,r-s r'in_y_pred_rangezBaseLoss.in_y_pred_ranger0r)c|tj|}|jdk(r#|jddk(r|j d}|j j ||||||S)aJCompute 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. rry_trueraw_prediction sample_weightloss_out n_threads)r" empty_likendimshapesqueezerloss)r&r5r6r7r8r9s r'r>z BaseLoss.lossss<  }}V,H   ! #(<(  ==8L   ! #(<(%--a0K ##)'%# $ [((r)c Xtj|j||dd||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. Nr4weights)r"averager>)r&r5r6r7r9s r'__call__zBaseLoss.__call__s:(zz II-"#  "  r)ctj||d}dtj|jjz}|j j tj k(rd}nF|j jr|j j }n|j j |z}|j jtjk(rd}nF|j jr|j j}n|j j|z }|||jj|S|jjtj|||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. rrKaxis N) r"rLfinforAepsr%lowr# low_inclusivehighhigh_inclusiverclip)r&r5r7y_predrSa_mina_maxs r'fit_intercept_onlyzBaseLoss.fit_intercept_onlys(FMB288FLL)---    # #w .E  ! ! / /((,,E((,,s2E    $ $ .E  ! ! 0 0((--E((--3E =U]99>>&) )99>>"''&%"?@ @r)c,tj|S)zpCalculate term dropped in loss. With this term added, the loss of perfect predictions is zero. )r" zeros_liker&r5r7s r'constant_to_optimal_zeroz!BaseLoss.constant_to_optimal_zeros }}V$$r)FcV|tjtjfvrtd|d|jr||j f}n|f}tj |||}|jrtjd|}||fStj |||}||fS)auInitialize 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<rAorder)r)r<rA) r"float32float64 ValueError is_multiclassr!emptyr ones)r& n_samplesrArcr<rEhessians r'init_gradient_and_hessianz"BaseLoss.init_gradient_and_hessians8 RZZ0 0"G9.    /ELE88%uEB  ggD6G  hhU%uEG  r)N)NNrNNNrNr)__name__ __module__ __qualname____doc__differentiableneed_update_leaves_valuesrgr(r/r2r>rCrErHrMr\r`r"rerlr)r'rrFs/tN %M900 +b=&F /j@)D >(AT%:<31!r)rc$eZdZdZdfd ZxZS)HalfSquaredErroraHalf 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. cZt|tt|du|_y)Nrr)superr(rrr r&r7 __class__s r'r(zHalfSquaredError.__init__s( 13,.I - 5r)rmrprqrrrsr( __classcell__r}s@r'rxrxs"66r)rxc4eZdZdZdZdZdfd ZddZxZS) AbsoluteErroraAbsolute 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. FTcht|ttd|_|du|_y)NrzT)r{r(r rrr r|s r'r(zAbsoluteError.__init__3s/ 0|~F" - 5r)cN|tj|dSt||dS)Compute raw_prediction of an intercept-only model. This is the weighted median of the target, i.e. over the samples axis=0. rrP2)r"medianrr_s r'r\z AbsoluteError.fit_intercept_only8s*  99V!, ,' rB Br)rm rprqrrrsrtrur(r\rrs@r'rrs "N $6 Cr)rc4eZdZdZdZdZdfd ZddZxZS) PinballLossaQuantile 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). FTct|dtjdddt|t t |td|_|du|_ y) Nquantilerrneither target_typemin_valmax_valinclude_boundaries)rrzT) rnumbersRealr{r(rfloatrrr )r&r7rr}s r'r(zPinballLoss.__init__es]   (   x9  # - 5r)c|/tj|d|jjzdSt ||d|jjzS)rdrr)r" percentilerrrr_s r'r\zPinballLoss.fit_intercept_onlyusO  ==tzz/B/B)BK K' sTZZ-@-@'@ r))N?rmrrs@r'rrDs:N $6 r)rc4eZdZdZdZdZdfd ZddZxZS) HuberLossaHuber 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. FTct|dtjddd||_t|t t|td|_ d |_ y) Nrrrrr)deltarzTF) rrrrr{r(rrrrr )r&r7rrr}s r'r(zHuberLoss.__init__s_   (  !  E%L1  # %r)c6|tj|dd}n t||d}||z }tj|tj|j j tj|z}|tj||zS)rrrrrJ) r"rrsignminimumrrabsrL)r&r5r7rdiffterms r'r\zHuberLoss.fit_intercept_onlysx  ]]62A6F)&-DFwwt}rzz$***:*:BFF4LII 4???r))Ng?rrmrrs@r'rrs!BN $&"@r)rc,eZdZdZdfd ZddZxZS)HalfPoissonLossaHalf 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`. ct|ttt dt j dd|_y)NrzrTF)r{r(rrrr"r#r$r|s r'r(zHalfPoissonLoss.__init__s2 02C'2664?r)c2t|||z }|||z}|Srmrr&r5r7rs r'r`z(HalfPoissonLoss.constant_to_optimal_zeros(VV$v-  $ M !D r)rmrprqrrrsr(r`rrs@r'rrs(@r)rc,eZdZdZdfd ZddZxZS) HalfGammaLossaVHalf 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`. ct|ttt dt j dd|_y)NrzrF)r{r(r rrr"r#r$r|s r'r(zHalfGammaLoss.__init__s1 0wyA'2665%@r)cFtj| dz }|||z}|Sro)r"logrs r'r`z&HalfGammaLoss.constant_to_optimal_zeros+v"  $ M !D r)rmrrs@r'rrs&Ar)rc,eZdZdZdfd ZddZxZS)HalfTweedieLossaHalf 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. ct|tt|t |j j dkr1ttj tjdd|_ y|j j dkr"tdtjdd|_ ytdtjdd|_ yN)powerrzrFrT) r{r(rrrrrrr"r#r$r&r7rr}s r'r(zHalfTweedieLoss.__init__*s #%,7   ::  q #+RVVGRVVUE#JD ZZ   !#+ArvvtU#CD #+Arvvue#DD r)c|jjdk(rtj||S|jjdk(rt j||S|jjdk(rt j||S|jj}t jt j|dd|z d|z z d|z z }|||z}|S)Nr)r5r7rr)rrrxr`rrr"maximum)r&r5r7prs r'r`z(HalfTweedieLoss.constant_to_optimal_zero6s ::  q #%>>]? ZZ   ""$==]> ZZ   " ?;;]<    A88BJJvq11q59QUCq1uMD( %Kr)Ng?rmrrs@r'rr s< Er)rc$eZdZdZdfd ZxZS)HalfTweedieLossIdentityanHalf 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. ct|tt|t |j j dkr1ttj tjdd|_ n\|j j dkr"tdtjdd|_ n!tdtjdd|_ |j j dk(r1ttj tjdd|_ ytdtjdd|_ yr) r{r(rrrrrrr"r#r$r%rs r'r(z HalfTweedieLossIdentity.__init__gs +%,?   ::  q #+RVVGRVVUE#JD ZZ   !#+ArvvtU#CD #+Arvvue#DD ::  q #+RVVGRVVUE#JD #+Arvvue#DD r)rr~rs@r'rrKs6EEr)rc2eZdZdZdfd ZddZdZxZS)HalfBinomialLossaYHalf 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) cpt|ttdt dddd|_yNrrrr!rrT)r{r(r rrr$r|s r'r(zHalfBinomialLoss.__init__s8 $&  (1dD9r)cRt||td|z d|z z}|||z}|Srorrs r'r`z)HalfBinomialLoss.constant_to_optimal_zeros7VV$uQZV'DD  $ M !D r)c4|jdk(r#|jddk(r|jd}tj|jddf|j }|j j||dddf<d|dddfz |dddf<|Sa=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. rrrr@Nr;r<r=r"rhrArinverser&r6probas r' predict_probazHalfBinomialLoss.predict_proba   ! #(<(:r)rcLeZdZdZdZdfd ZdZd dZdZ d dZ xZ S) HalfMultinomialLossaCategorical 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>` Tct|tt|t dt j dd|_t dddd|_y)NrrTFr) r{r(r rrr"r#r$r%)r&r7r!r}s r'r(zHalfMultinomialLoss.__init__sP ')!#  (2664?'1eU;r)c|jj|xr+tj|j t |k(Sr+)r$r,r"allastypeintr-s r'r/z#HalfMultinomialLoss.in_y_true_ranges6##,,Q/NBFF188C=A;M4NNr)ctj|j|j}tj|jj }t |jD]@}tj||k(|d||<tj|||d|z ||<B|jj|dddfjdS)zCompute 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@rrOrN) r"zerosr!rArRrSrangerLrXrreshape)r&r5r7outrSks r'r\z&HalfMultinomialLoss.fit_intercept_onlys hht~~V\\:hhv||$((t~~& 3AZZ! ]KCFWWSVS!c'2CF 3yy~~c$'l+33B77r)c8|jj|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. )rr)r&r6s r'rz!HalfMultinomialLoss.predict_probasyy  00r)c|C|+tj|}tj|}n-tj|}n|tj|}|jj||||||||fS)aKCompute 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. )r5r6r7rB proba_outr9)r"r:rgradient_proba)r&r5r6r7rBrr9s r'rz"HalfMultinomialLoss.gradient_probasH   !}}^< MM.9 !}}Y7   l3I !!)'% " Y&&r))Nrmrn) rprqrrrsrgr(r/r\rrrrs@r'rrs8 DM<O 8 1&5'r)rc2eZdZdZdfd ZddZdZxZS)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)) cpt|ttdt dddd|_yr)r{r(r rrr$r|s r'r(zExponentialLoss.__init__ms8 #%  (1dD9r)cPdtj|d|z zz}|||z}|S)Nr)r"sqrtrs r'r`z(ExponentialLoss.constant_to_optimal_zerous3BGGFa&j122  $ M !D r)c4|jdk(r#|jddk(r|jd}tj|jddf|j }|j j||dddf<d|dddfz |dddf<|Srrrs r'rzExponentialLoss.predict_proba|rr)rmrrs@r'rrIs!F:r)r) squared_errorabsolute_error pinball_loss huber_loss poisson_loss gamma_loss tweedie_loss binomial_lossmultinomial_lossexponential_loss)*rsrnumpyr" scipy.specialrutilsr utils.statsr_lossr r r r r rrrrrrrrrrrrrrrxrrrrrrrrrr_LOSSESrvr)r'rs* .    8z!z!B6x6.#CH#CL<(<~F@F@Rh@H>=h=@+Eh+E\BxBJH'(H'VFhFT&###%+' r)