class_docstr: The pack-sum format
  
  Parameters
  ----------
  dmatrix : xgb.DMatrix
      A float64 array of shape [n, m],
      where `n` is the packed number of blocks,
      and `m` is the length of feature vector on each block
  ids : np.ndarray
      An int64 array of shape [n] containing nonnegative integers,
      indicating which the index of a sample that a block belongs to
class_docstr_tok: ["The","pack-sum","format","Parameters","--","--","--","--","--","dmatrix",":","xgb.DMatrix","A","float64","array","of","shape","[","n",",","m","]",",","where","`","n","`","is","the","packed","number","of","blocks",",","and","`","m","`","is","the","length","of","feature","vector","on","each","block","ids",":","np.ndarray","An","int64","array","of","shape","[","n","]","containing","nonnegative","integers",",","indicating","which","the","index","of","a","sample","that","a","block","belongs","to"]
docstr: Implement square error loss on pack-sum format as
  a custom objective function for xgboost.
  
  Parameters
  ----------
  ys_pred: np.ndarray
      The predictions
  
  Returns
  -------
  gradient: np.ndarray
      The gradient according to the xgboost format
  hessian: np.ndarray
      The hessian according to the xgboost format
docstr_tok: ["Implement","square","error","loss","on","pack-sum","format","as","a","custom","objective","function","for","xgboost",".","Parameters","--","--","--","--","--","ys_pred",":","np.ndarray","The","predictions","Returns","--","--","--","-","gradient",":","np.ndarray","The","gradient","according","to","the","xgboost","format","hessian",":","np.ndarray","The","hessian","according","to","the","xgboost","format"]
code: def obj_square_error(
      self, ys_pred: np.ndarray
  ) -> Tuple[np.ndarray, np.ndarray]:
      """Implement square error loss on pack-sum format as
      a custom objective function for xgboost.
  
      Parameters
      ----------
      ys_pred: np.ndarray
          The predictions
  
      Returns
      -------
      gradient: np.ndarray
          The gradient according to the xgboost format
      hessian: np.ndarray
          The hessian according to the xgboost format
      """
      # Making prediction
      ys_pred = self.predict_with_score(ys_pred)
      # Propagate prediction to each block
      ys_pred = ys_pred[
          self.ids
      ]  # pylint: disable=invalid-sequence-index
      # The gradient and hessian
      ys = self.dmatrix.get_label()  # type: ignore # pylint: disable=invalid-name
      gradient = ys_pred - ys
      hessian = np.ones_like(gradient)
      return gradient * ys, hessian * ys
  
imports: import os
  import tempfile
  from collections import OrderedDict
  from itertools import chain
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Optional, Tuple
  from typing_extensions import Literal
  import numpy
  from ...contrib.tar import tar, untar
  from ...runtime import NDArray
  from ..cost_model import PyCostModel
  from ..feature_extractor import FeatureExtractor
  from ..logging import get_logger
  from ..runner import RunnerResult
  from ..search_strategy import MeasureCandidate
  from ..utils import cpu_count, derived_object, shash2hex
  from .metric import max_curve
label_desc: Use image node_id 3 for calling the PackSum obj's underlying member method code with example usage: obj.obj_square_error(ys_pred) and returns: unknown,  unknown