class_docstr: Operations related to the Lagrangian.
  
  Parameters
  ----------
  X : {numpy.ndarray, pandas.DataFrame}
      the training features
  sensitive_features : {numpy.ndarray, pandas.Series, pandas.DataFrame, list}
      the sensitive features to use for constraints
  y : {numpy.ndarray, pandas.Series, pandas.DataFrame, list}
      the training labels
  estimator :
      the estimator to fit in every iteration of :meth:`best_h` using a
      :meth:`fit` method with arguments `X`, `y`, and `sample_weight`
  constraints : fairlearn.reductions.Moment
      Object describing the fairness constraints. This provides the reweighting
      and relabelling.
  objective : fairlearn.reductions.Moment
      Object describing the optimization objective. The default is :code:`ErrorRate()` for
      binary classification and :code:`MeanLoss(...)` for regression.
  B : float
      bound on the L1-norm of the lambda vector
  opt_lambda : bool
      indicates whether to optimize lambda during the calculation of the
      Lagrangian; optional with default value True
  sample_weight_name : str
      Name of the argument to `estimator.fit()` which supplies the sample weights
      (defaults to `sample_weight`)
code: def __init__(
      self,
      *,
      X,
      y,
      estimator,
      constraints,
      B,
      objective=None,
      opt_lambda=True,
      sample_weight_name="sample_weight",
      **kwargs,
  ):
      self.constraints = constraints
      self.constraints.load_data(X, y, **kwargs)
      if objective is None:
          self.obj = self.constraints.default_objective()
      elif objective._moment_type() == constraints._moment_type():
          self.obj = objective
      else:
          raise ValueError(
              _MESSAGE_BAD_OBJECTIVE.format(
                  objective._moment_type(), constraints._moment_type()
              )
          )
      self.obj.load_data(X, y, **kwargs)
      self.estimator = estimator
      self.B = B
      self.opt_lambda = opt_lambda
      self.hs = pd.Series(dtype="float64")
      self.predictors = pd.Series(dtype="float64")
      self.errors = pd.Series(dtype="float64")
      self.gammas = pd.DataFrame()
      self.lambdas = pd.DataFrame()
      self.n_oracle_calls = 0
      self.oracle_execution_times = []
      self.n_oracle_calls_dummy_returned = 0
      self.last_linprog_n_hs = 0
      self.last_linprog_result = None
      self.sample_weight_name = sample_weight_name
  
imports: import logging
  from time import time
  import numpy
  import pandas
  import scipy.optimize
  from sklearn import clone
  from sklearn.dummy import DummyClassifier
  from fairlearn.reductions._moments import ClassificationMoment
  from ._constants import _INDENTATION, _LINE, _PRECISION
label_desc: Use image node_id 1 to create a new _Lagrangian object  with example: obj = _Lagrangian()