code: def test_regression_model(
      spark_context, regression_model, boston_housing_dataset
  ):
      batch_size = 64
      epochs = 10
  
      x_train, y_train, x_test, y_test = boston_housing_dataset
      df = to_data_frame(spark_context, x_train, y_train)
      test_df = to_data_frame(spark_context, x_test, y_test)
  
      sgd = optimizers.SGD(lr=0.00001)
      sgd_conf = optimizers.serialize(sgd)
      estimator = ElephasEstimator()
      estimator.set_keras_model_config(regression_model.to_json())
      estimator.set_optimizer_config(sgd_conf)
      estimator.set_mode("synchronous")
      estimator.set_loss("mae")
      estimator.set_metrics(["mae"])
      estimator.set_epochs(epochs)
      estimator.set_batch_size(batch_size)
      estimator.set_validation_split(0.01)
      estimator.set_categorical_labels(False)
  
      pipeline = Pipeline(stages=[estimator])
      fitted_pipeline = pipeline.fit(df)
      prediction = fitted_pipeline.transform(test_df)
      pnl = prediction.select("label", "prediction")
      pnl.show(100)
  
      prediction_and_observations = pnl.rdd.map(
          lambda row: (row.label, row.prediction)
      )
      metrics = RegressionMetrics(prediction_and_observations)
      print(metrics.r2)
  
imports: import numpy
  import pytest
  from pyspark.ml import Pipeline
  from pyspark.mllib.evaluation import MulticlassMetrics, RegressionMetrics
  from pyspark.sql.types import DoubleType
  from tensorflow.keras import optimizers
  from tensorflow.keras.activations import relu
  from tensorflow.keras.layers import Dense
  from tensorflow.keras.models import Sequential
  from elephas.ml.adapter import to_data_frame
  from elephas.ml_model import ElephasEstimator, load_ml_estimator, ElephasTransformer, load_ml_transformer
  from elephas.utils.model_utils import ModelType, argmax
label_desc: Use image node_id 6 for calling a global function with example usage: test_regression_model(spark_context, regression_model, boston_housing_dataset) without return types