class_docstr: A moment for constraining the mean loss or the worst-case loss by a group.
  
  Read more in the :ref:`User Guide <bounded_group_loss>`.
  
  Parameters
  ----------
  loss : {SquareLoss, AbsoluteLoss}
      A loss object with an `eval` method, e.g. `SquareLoss` or
      `AbsoluteLoss`.
  upper_bound : float
      An upper bound on the loss, also referred to as :math:`\\zeta`;
      `upper_bound` is an optional argument that is not always
      required; default None
  no_groups : bool
      indicates whether to calculate the mean loss or group-level losses,
      default False, i.e., group-level losses are the default behavior
class_docstr_tok: ["A","moment","for","constraining","the","mean","loss","or","the","worst-case","loss","by","a","group",".","Read","more","in","the",":","ref",":","`","User","Guide","<","bounded_group_loss",">","`",".","Parameters","--","--","--","--","--","loss",":","{","SquareLoss",",","AbsoluteLoss","}","A","loss","object","with","an","`","eval","`","method",",","e.g",".","`","SquareLoss","`","or","`","AbsoluteLoss","`",".","upper_bound",":","float","An","upper","bound","on","the","loss",",","also","referred","to","as",":","math",":","`","\\\\zeta","`",";","`","upper_bound","`","is","an","optional","argument","that","is","not","always","required",";","default","None","no_groups",":","bool","indicates","whether","to","calculate","the","mean","loss","or","group-level","losses",",","default","False",",","i.e.",",","group-level","losses","are","the","default","behavior"]
docstr: Load data into the moment object.
docstr_tok: ["Load","data","into","the","moment","object","."]
code: def load_data(self, X, y, *, sensitive_features):
      """Load data into the moment object."""
      X_train, y_train, sf_train, _ = _validate_and_reformat_input(
          X,
          y,
          enforce_binary_labels=False,
          sensitive_features=sensitive_features,
      )
      if self.no_groups:
          sf_train = y_train.apply(lambda v: _ALL)
  
      # The following uses X and not X_train so that the estimators get X untouched
      super().load_data(X, y_train, sensitive_features=sf_train)
      self.prob_attr = (
          self.tags.groupby(_GROUP_ID).size() / self.total_samples
      )
      self.index = self.prob_attr.index
      self.default_objective_lambda_vec = self.prob_attr
  
      # fill in the information about the basis
      attr_vals = self.tags[_GROUP_ID].unique()
      self.pos_basis = pd.DataFrame()
      self.neg_basis = pd.DataFrame()
      self.neg_basis_present = pd.Series(dtype="float64")
      zero_vec = pd.Series(0.0, self.index)
      i = 0
      for attr in attr_vals:
          self.pos_basis[i] = 0 + zero_vec
          self.neg_basis[i] = 0 + zero_vec
          self.pos_basis[i][attr] = 1
          self.neg_basis_present.at[i] = False
          i += 1
  
imports: import numpy
  import pandas
  from fairlearn.utils._input_validation import _validate_and_reformat_input
  from .moment import _ALL, _GROUP_ID, _LABEL, _LOSS, _PREDICTION, LossMoment
label_desc: Use image node_id 3 for calling the ConditionalLossMoment obj's underlying member method code with example usage: obj.load_data(X, y) without return types