code: def test_StackingEstimator_4():
      """Assert that the StackingEstimator worked as expected in scikit-learn pipeline in regression."""
      stack_reg = StackingEstimator(
          estimator=RandomForestRegressor(random_state=42)
      )
      meta_reg = Lasso(random_state=42)
      sklearn_pipeline = make_pipeline(stack_reg, meta_reg)
      # fit in pipeline
      sklearn_pipeline.fit(training_features_r, training_target_r)
      # fit step by step
      stack_reg.fit(training_features_r, training_target_r)
      X_reg_transformed = stack_reg.transform(training_features_r)
      meta_reg.fit(X_reg_transformed, training_target_r)
      # scoring
      score = meta_reg.score(X_reg_transformed, training_target_r)
      pipeline_score = sklearn_pipeline.score(
          training_features_r, training_target_r
      )
      assert np.allclose(score, pipeline_score)
  
      # test cv score
      cv_score = np.mean(
          cross_val_score(
              sklearn_pipeline,
              training_features_r,
              training_target_r,
              cv=3,
              scoring="r2",
          )
      )
      known_cv_score = 0.819780677881384
  
      # On some non-amd64 systems such as arm64, a resulting score of
      # 0.8207525232725118 was observed, so we need to add a tolerance there
      if platform.machine() != "x86_64":
          assert np.allclose(known_cv_score, cv_score, rtol=0.01)
      else:
          assert np.allclose(known_cv_score, cv_score)
  
file_path: tpot/tests/stacking_estimator_tests.py
imports: import platform
  import numpy
  from tpot.builtins import StackingEstimator
  from sklearn.linear_model import LogisticRegression, Lasso
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
  from sklearn.pipeline import make_pipeline
  from tpot_tests import training_features, training_target, training_features_r, training_target_r
  from sklearn.model_selection import cross_val_score
  import warnings
label_desc: Use image node_id 4 for calling a global function with example usage: test_StackingEstimator_4() without return types