class_docstr: 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.
class_docstr_tok: ["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","."]
docstr: 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.
docstr_tok: ["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","."]
code: def loss(
      self,
      y_true,
      raw_prediction,
      sample_weight=None,
      loss_out=None,
      n_threads=1,
  ):
      """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.
          """
      if loss_out is None:
          loss_out = np.empty_like(y_true)
      # Be graceful to shape (n_samples, 1) -> (n_samples,)
      if raw_prediction.ndim == 2 and raw_prediction.shape[1] == 1:
          raw_prediction = raw_prediction.squeeze(1)
  
      self.closs.loss(
          y_true=y_true,
          raw_prediction=raw_prediction,
          sample_weight=sample_weight,
          loss_out=loss_out,
          n_threads=n_threads,
      )
      return loss_out
  
imports: import numbers
  import numpy
  from scipy.special import xlogy
  from ..utils import check_scalar
  from ..utils.stats import _weighted_percentile
  from ._loss import CyAbsoluteError, CyExponentialLoss, CyHalfBinomialLoss, CyHalfGammaLoss, CyHalfMultinomialLoss, CyHalfPoissonLoss, CyHalfSquaredError, CyHalfTweedieLoss, CyHalfTweedieLossIdentity, CyHuberLoss, CyPinballLoss
  from .link import HalfLogitLink, IdentityLink, Interval, LogitLink, LogLink, MultinomialLogit
label_desc: Use image node_id 4 for calling the BaseLoss obj's underlying member method code with example usage: obj.loss(y_true, raw_prediction, sample_weight, loss_out, n_threads) and returns: loss_out