code: def test_given_different_batch_sizes_when_estimating_marginal_expectation_then_returns_correct_marginal_expectations():
      X = np.random.normal(0, 1, (34, 3))
      feature_samples = np.random.normal(0, 1, (123, 3))
      expected_non_aggregated = np.array(
          [
              repmat(X[i, :], feature_samples.shape[0], 1)
              for i in range(X.shape[0])
          ]
      )
  
      def my_pred_func(X: np.ndarray) -> np.ndarray:
          return X.copy()
  
      assert marginal_expectation(
          my_pred_func, feature_samples, X, [0, 1, 2], max_batch_size=1
      ) == approx(X)
      assert marginal_expectation(
          my_pred_func, feature_samples, X, [0, 1, 2], max_batch_size=10
      ) == approx(X)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=100,
      ) == approx(X)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=1000,
      ) == approx(X)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=feature_samples.shape[0],
      ) == approx(X)
  
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=1,
          return_averaged_results=False,
      ) == approx(expected_non_aggregated)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=10,
          return_averaged_results=False,
      ) == approx(expected_non_aggregated)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=100,
          return_averaged_results=False,
      ) == approx(expected_non_aggregated)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=1000,
          return_averaged_results=False,
      ) == approx(expected_non_aggregated)
      assert marginal_expectation(
          my_pred_func,
          feature_samples,
          X,
          [0, 1, 2],
          max_batch_size=feature_samples.shape[0],
          return_averaged_results=False,
      ) == approx(expected_non_aggregated)
  
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 12 for calling a global function with example usage: test_given_different_batch_sizes_when_estimating_marginal_expectation_then_returns_correct_marginal_expectations() and returns: X