class_docstr: An Estimator which implements the exponentiated gradient reduction.
  
  The exponentiated gradient algorithm is described in detail by
  :footcite:t:`agarwal2018reductions`.
  
  Read more in the :ref:`User Guide <exponentiated_gradient>`.
  
  .. versionchanged:: 0.3.0
      Was a function before, not a class
  
  .. versionchanged:: 0.4.6
      Requires 0-1 labels for classification problems
  
  Parameters
  ----------
  estimator : estimator
      An estimator implementing methods :code:`fit(X, y, sample_weight)` and
      :code:`predict(X)`, where `X` is the matrix of features, `y` is the
      vector of labels (binary classification) or continuous values
      (regression), and `sample_weight` is a vector of weights.
      In binary classification labels `y` and predictions returned by
      :code:`predict(X)` are either 0 or 1.
      In regression values `y` and predictions are continuous.
  constraints : fairlearn.reductions.Moment
      The fairness constraints expressed as a :class:`~Moment`.
  objective : fairlearn.reductions.Moment
      The objective expressed as a :class:`~Moment`. The default is
      :code:`ErrorRate()` for binary classification and
      :code:`MeanLoss(...)` for regression.
  eps : float
      Allowed fairness constraint violation; the solution is guaranteed to
      have the error within :code:`2*best_gap` of the best error under
      constraint `eps`; the constraint violation is at most
      :code:`2*(eps+best_gap)`.
  
      .. versionchanged:: 0.5.0
          :code:`eps` is now only responsible for setting the L1 norm bound
          in the optimization
  max_iter : int
      Maximum number of iterations
  
      .. versionadded:: 0.5.0
          Used to be :code:`T`
  
  nu : float
      Convergence threshold for the duality gap, corresponding to a
      conservative automatic setting based on the statistical uncertainty
      in measuring classification error
  
  eta0 : float
      Initial setting of the learning rate
  
      .. versionadded:: 0.5.0
          Used to be :code:`eta_mul`
  
  run_linprog_step : bool
      if True each step of exponentiated gradient is followed by the saddle
      point optimization over the convex hull of classifiers returned so
      far; default True
  
      .. versionadded:: 0.5.0
  
  sample_weight_name : str
      Name of the argument to `estimator.fit()` which supplies the sample weights
      (defaults to `sample_weight`)
  
      .. versionadded:: 0.5.0
docstr: Provide predictions for the given input data.
  
  Predictions are randomized, i.e., repeatedly calling `predict` with
  the same feature data may yield different output. This
  non-deterministic behavior is intended and stems from the nature of
  the exponentiated gradient algorithm.
  
  Notes
  -----
  A fitted ExponentiatedGradient has an attribute `predictors_`, an
  array of predictors, and an attribute `weights_`, an array of
  non-negative floats of the same length.
  The prediction on each data point in `X` is obtained by first picking
  a random predictor according to the probabilities in `weights_` and
  then applying it. Different predictors can be chosen on different data
  points.
  
  Parameters
  ----------
  X : numpy.ndarray or pandas.DataFrame
      Feature data
  random_state : int or RandomState instance, default=None
      Controls random numbers used for randomized predictions. Pass an
      int for reproducible output across multiple function calls.
  
  Returns
  -------
  Scalar or vector
      The prediction. If `X` represents the data for a single example
      the result will be a scalar. Otherwise the result will be a vector
docstr_tok: ["Provide","predictions","for","the","given","input","data",".","Predictions","are","randomized",",","i.e.",",","repeatedly","calling","`","predict","`","with","the","same","feature","data","may","yield","different","output",".","This","non-deterministic","behavior","is","intended","and","stems","from","the","nature","of","the","exponentiated","gradient","algorithm",".","Notes","--","--","-","A","fitted","ExponentiatedGradient","has","an","attribute","`","predictors_","`",",","an","array","of","predictors",",","and","an","attribute","`","weights_","`",",","an","array","of","non-negative","floats","of","the","same","length",".","The","prediction","on","each","data","point","in","`","X","`","is","obtained","by","first","picking","a","random","predictor","according","to","the","probabilities","in","`","weights_","`","and","then","applying","it",".","Different","predictors","can","be","chosen","on","different","data","points",".","Parameters","--","--","--","--","--","X",":","numpy.ndarray","or","pandas.DataFrame","Feature","data","random_state",":","int","or","RandomState","instance",",","default=None","Controls","random","numbers","used","for","randomized","predictions",".","Pass","an","int","for","reproducible","output","across","multiple","function","calls",".","Returns","--","--","--","-","Scalar","or","vector","The","prediction",".","If","`","X","`","represents","the","data","for","a","single","example","the","result","will","be","a","scalar",".","Otherwise","the","result","will","be","a","vector"]
code: def predict(self, X, random_state=None):
      """Provide predictions for the given input data.
  
      Predictions are randomized, i.e., repeatedly calling `predict` with
      the same feature data may yield different output. This
      non-deterministic behavior is intended and stems from the nature of
      the exponentiated gradient algorithm.
  
      Notes
      -----
      A fitted ExponentiatedGradient has an attribute `predictors_`, an
      array of predictors, and an attribute `weights_`, an array of
      non-negative floats of the same length.
      The prediction on each data point in `X` is obtained by first picking
      a random predictor according to the probabilities in `weights_` and
      then applying it. Different predictors can be chosen on different data
      points.
  
      Parameters
      ----------
      X : numpy.ndarray or pandas.DataFrame
          Feature data
      random_state : int or RandomState instance, default=None
          Controls random numbers used for randomized predictions. Pass an
          int for reproducible output across multiple function calls.
  
      Returns
      -------
      Scalar or vector
          The prediction. If `X` represents the data for a single example
          the result will be a scalar. Otherwise the result will be a vector
      """
      check_is_fitted(self)
      random_state = check_random_state(random_state)
  
      if isinstance(self.constraints, ClassificationMoment):
          positive_probs = self._pmf_predict(X)[:, 1]
          return (
              positive_probs >= random_state.rand(len(positive_probs))
          ) * 1
      else:
          pred = self._pmf_predict(X)
          randomized_pred = np.zeros(pred.shape[0])
          for i in range(pred.shape[0]):
              randomized_pred[i] = random_state.choice(
                  pred.iloc[i, :], p=self.weights_
              )
          return randomized_pred
  
file_path: fairlearn/fairlearn/reductions/_exponentiated_gradient/exponentiated_gradient.py
imports: import logging
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, MetaEstimatorMixin
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import check_is_fitted
  from fairlearn.reductions._moments import ClassificationMoment
  from ._constants import _ACCURACY_MUL, _INDENTATION, _MIN_ITER, _PRECISION, _REGRET_CHECK_INCREASE_T, _REGRET_CHECK_START_T, _SHRINK_ETA, _SHRINK_REGRET
  from ._lagrangian import _Lagrangian
label_desc: Use image node_id 3 for calling the ExponentiatedGradient obj's underlying member method code with example usage: obj.predict(X, random_state) and returns: unknown, randomized_pred