code: def test_error_rate_consistency(self, eps, ratio, pos_copies):
      learner = LeastSquaresBinaryClassifierLearner()
      if ratio is None:
          constraints_moment = EqualizedOdds(difference_bound=eps)
      else:
          constraints_moment = EqualizedOdds(
              ratio_bound=ratio, ratio_bound_slack=eps
          )
  
      results = {}
      for method in ["costs", "sampling"]:
          X, y, A = _get_data()
  
          if method == "sampling":
              select = y == 1
              X = pd.concat(
                  (X,) + (X.loc[select, :],) * pos_copies
              ).values
              y = pd.concat((y,) + (y[select],) * pos_copies).values
              A = pd.concat((A,) + (A[select],) * pos_copies).values
              objective_moment = ErrorRate()
          else:
              objective_moment = ErrorRate(
                  costs={"fn": 1.0 + pos_copies, "fp": 1.0}
              )
  
          expgrad = ExponentiatedGradient(
              learner,
              constraints=deepcopy(constraints_moment),
              objective=deepcopy(objective_moment),
              eps=eps,
              nu=1e-3,
          )
  
          expgrad.fit(X, y, sensitive_features=A)
  
          # select probability of predicting 1
          def Q(X):
              return expgrad._pmf_predict(X)[:, 1]
  
          constraints_eval = deepcopy(constraints_moment)
          constraints_eval.load_data(X, y, sensitive_features=A)
          disparity = constraints_eval.gamma(Q).max()
  
          objective_eval = deepcopy(objective_moment)
          objective_eval.load_data(X, y, sensitive_features=A)
          total_error = objective_eval.gamma(Q).iloc[0] * len(y)
          results[method] = {
              "error": objective_eval.gamma(Q).iloc[0],
              "total_error": total_error,
              "disp": disparity,
              "n_predictors": len(expgrad.predictors_),
              "best_gap": expgrad.best_gap_,
              "last_iter": expgrad.last_iter_,
              "best_iter": expgrad.best_iter_,
              "n_oracle_calls": expgrad.n_oracle_calls_,
              "n_oracle_calls_dummy_returned": expgrad.n_oracle_calls_dummy_returned_,
          }
  
      self._assert_expgrad_two_states(
          results["costs"], results["sampling"]
      )
  
imports: from copy import deepcopy
  import numpy
  import pandas
  import pytest
  from sklearn.dummy import DummyClassifier
  from sklearn.linear_model import LogisticRegression
  from fairlearn.reductions import AbsoluteLoss, BoundedGroupLoss, DemographicParity, EqualizedOdds, ErrorRate, ErrorRateParity, ExponentiatedGradient, FalsePositiveRateParity, SquareLoss, TruePositiveRateParity, ZeroOneLoss
  from fairlearn.reductions._exponentiated_gradient._constants import _MIN_ITER
  from fairlearn.reductions._moments.bounded_group_loss import MeanLoss
  from .simple_learners import LeastSquaresBinaryClassifierLearner, LeastSquaresRegressor
  from .test_utilities import _get_data
label_desc: Use image node_id 9 for calling the TestExponentiatedGradientSmoke obj's underlying member method code with example usage: obj.test_error_rate_consistency(eps, ratio, pos_copies) and returns: expgrad