class_docstr: Implementation of demographic parity as a moment.
  
  A classifier :math:`h(X)` satisfies demographic parity if
  
  .. math::
    P[h(X) = 1 | A = a] = P[h(X) = 1] \; \forall a
  
  This implementation of :class:`UtilityParity` defines
  a single event, `all`. Consequently, the `prob_event`
  :class:`pandas:pandas.Series`
  will only have a single entry, which will be equal to 1.
  Similarly, the `index` property will have twice as many entries
  (corresponding to the Lagrange multipliers for positive and negative
  constraints) as there are unique values for the sensitive feature.
  The :meth:`UtilityParity.signed_weights` method will compute the costs
  according to Example 3 of :footcite:t:`agarwal2018reductions`.
  
  This :class:`~Moment` also supports control features, which can be used to
  stratify the data, with the Demographic Parity constraint applied within
  each stratum, but not between strata. If the control feature groups
  are :math:`c \in \mathcal{C}` then the above equation will become
  
  .. math::
    P[h(X) = 1 | A = a, C = c] = P[h(X) = 1 | C = c] \; \forall a, c
  
  Read more in the :ref:`User Guide <demographic_parity>`.
class_docstr_tok: ["Implementation","of","demographic","parity","as","a","moment",".","A","classifier",":","math",":","`","h","(","X",")","`","satisfies","demographic","parity","if","..","math",":",":","P","[","h","(","X",")","=","1","|","A","=","a","]","=","P","[","h","(","X",")","=","1","]","\\",";","\\forall","a","This","implementation","of",":","class",":","`","UtilityParity","`","defines","a","single","event",",","`","all","`",".","Consequently",",","the","`","prob_event","`",":","class",":","`","pandas",":","pandas.Series","`","will","only","have","a","single","entry",",","which","will","be","equal","to","1",".","Similarly",",","the","`","index","`","property","will","have","twice","as","many","entries","(","corresponding","to","the","Lagrange","multipliers","for","positive","and","negative","constraints",")","as","there","are","unique","values","for","the","sensitive","feature",".","The",":","meth",":","`","UtilityParity.signed_weights","`","method","will","compute","the","costs","according","to","Example","3","of",":","footcite",":","t",":","`","agarwal2018reductions","`",".","This",":","class",":","`","~Moment","`","also","supports","control","features",",","which","can","be","used","to","stratify","the","data",",","with","the","Demographic","Parity","constraint","applied","within","each","stratum",",","but","not","between","strata",".","If","the","control","feature","groups","are",":","math",":","`","c","\\in","\\mathcal","{","C","}","`","then","the","above","equation","will","become","..","math",":",":","P","[","h","(","X",")","=","1","|","A","=","a",",","C","=","c","]","=","P","[","h","(","X",")","=","1","|","C","=","c","]","\\",";","\\forall","a",",","c","Read","more","in","the",":","ref",":","`","User","Guide","<","demographic_parity",">","`","."]
docstr: Load the specified data into the object.
docstr_tok: ["Load","the","specified","data","into","the","object","."]
code: def load_data(
      self, X, y, *, sensitive_features, control_features=None
  ):
      """Load the specified data into the object."""
      _, y_train, sf_train, cf_train = _validate_and_reformat_input(
          X,
          y,
          enforce_binary_labels=True,
          sensitive_features=sensitive_features,
          control_features=control_features,
      )
  
      base_event = pd.Series(data=_ALL, index=y_train.index)
      event = _merge_event_and_control_columns(base_event, cf_train)
      super().load_data(
          X, y_train, event=event, sensitive_features=sf_train
      )
  
imports: import numpy
  import pandas
  from fairlearn.utils._input_validation import _MESSAGE_RATIO_NOT_IN_RANGE, _validate_and_reformat_input
  from .error_rate import ErrorRate
  from .moment import _ALL, _EVENT, _GROUP_ID, _LABEL, _SIGN, ClassificationMoment
label_desc: Use image node_id 1 for calling the DemographicParity obj's underlying member method code with example usage: obj.load_data(X, y) without return types