code: def test_calib_eq_odds_sex_weighted(old_adult, new_adult):
      """Test that the old and new CalibratedEqualizedOdds produce the same mix
      rates.
      """
      X, y, sample_weight = new_adult
      logreg = LogisticRegression(solver="lbfgs", max_iter=500)
      y_pred = logreg.fit(
          X, y, sample_weight=sample_weight
      ).predict_proba(X)
      adult_pred = old_adult.copy()
      adult_pred.scores = y_pred[:, 1]
      orig_cal_eq_odds = CalibratedEqOddsPostprocessing(
          unprivileged_groups=[{"sex": 0}],
          privileged_groups=[{"sex": 1}],
      )
      orig_cal_eq_odds.fit(old_adult, adult_pred)
      cal_eq_odds = CalibratedEqualizedOdds("sex")
      cal_eq_odds.fit(y_pred, y, sample_weight=sample_weight)
  
      assert np.isclose(
          orig_cal_eq_odds.priv_mix_rate, cal_eq_odds.mix_rates_[1]
      )
      assert np.isclose(
          orig_cal_eq_odds.unpriv_mix_rate, cal_eq_odds.mix_rates_[0]
      )
  
file_path: AIF360/tests/sklearn/test_calibrated_equalized_odds.py
imports: import numpy
  import pytest
  import sklearn
  from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import train_test_split
  from aif360.algorithms.postprocessing import CalibratedEqOddsPostprocessing
  from aif360.sklearn.postprocessing import CalibratedEqualizedOdds, PostProcessingMeta
label_desc: Use image node_id 1 for calling a global function with example usage: test_calib_eq_odds_sex_weighted(old_adult, new_adult) without return types