code: def test_given_linear_categorical_data_when_evaluate_marginal_expectation_then_returns_correct_marginal_expectations():
      X = np.random.normal(0, 1, (1000, 3))
      Y = 3 * X[:, 0] + 2 * X[:, 1] - X[:, 2]
      Y = (Y <= 0).reshape(-1)
  
      X0 = X[:, 0].reshape(-1, 1)
      X1 = X[:, 1].reshape(-1, 1)
      X2 = X[:, 2].reshape(-1, 1)
      X01 = X[:, :2]
  
      model_all_features = create_logistic_regression_classifier()
      model_all_features.fit(X, Y)
      model_feature_0 = create_logistic_regression_classifier()
      model_feature_0.fit(X0, Y)
      model_feature_1 = create_logistic_regression_classifier()
      model_feature_1.fit(X1, Y)
      model_feature_2 = create_logistic_regression_classifier()
      model_feature_2.fit(X2, Y)
      model_feature_01 = create_logistic_regression_classifier()
      model_feature_01.fit(X01, Y)
  
      assert np.sum(
          np.mean(
              np.abs(
                  model_feature_0.predict_probabilities(X0)
                  - marginal_expectation(
                      model_all_features.predict_probabilities,
                      X,
                      X,
                      [0],
                      feature_perturbation="randomize_columns_independently",
                  )
              ),
              axis=0,
          )
      ) == approx(0.2, abs=1)
      assert np.sum(
          np.mean(
              np.abs(
                  model_feature_1.predict_probabilities(X1)
                  - marginal_expectation(
                      model_all_features.predict_probabilities,
                      X,
                      X,
                      [1],
                      feature_perturbation="randomize_columns_independently",
                  )
              ),
              axis=0,
          )
      ) == approx(0.2, abs=1)
      assert np.sum(
          np.mean(
              np.abs(
                  model_feature_2.predict_probabilities(X2)
                  - marginal_expectation(
                      model_all_features.predict_probabilities,
                      X,
                      X,
                      [2],
                      feature_perturbation="randomize_columns_independently",
                  )
              ),
              axis=0,
          )
      ) == approx(0.2, abs=1)
      assert np.sum(
          np.mean(
              np.abs(
                  model_feature_01.predict_probabilities(X01)
                  - marginal_expectation(
                      model_all_features.predict_probabilities,
                      X,
                      X,
                      [0, 1],
                      feature_perturbation="randomize_columns_independently",
                  )
              ),
              axis=0,
          )
      ) == approx(0.2, abs=1)
  
imports: import numpy
  import pytest
  from flaky import flaky
  from numpy.matlib import repmat
  from pytest import approx
  from dowhy.gcm.ml import create_hist_gradient_boost_classifier, create_hist_gradient_boost_regressor, create_linear_regressor, create_logistic_regression_classifier
  from dowhy.gcm.stats import estimate_ftest_pvalue, marginal_expectation, quantile_based_fwer
  from dowhy.gcm.util.general import geometric_median
label_desc: Use image node_id 9 for calling a global function with example usage: test_given_linear_categorical_data_when_evaluate_marginal_expectation_then_returns_correct_marginal_expectations() without return types