code: def test_estimator_train(self):
      batch_size = 8
      epoch_num = 5
  
      images, labels = TestEstimator._generate_image_data(
          data_num=8, img_shape=(3, 224, 224)
      )
  
      image_rdd = self.sc.parallelize(images)
      labels = self.sc.parallelize(labels)
  
      sample_rdd = image_rdd.zip(labels).map(
          lambda img_label: zoo.common.Sample.from_ndarray(
              img_label[0], img_label[1]
          )
      )
  
      data_set = FeatureSet.sample_rdd(sample_rdd)
  
      model = TestEstimator._create_cnn_model()
  
      optim_method = SGD(learningrate=0.01)
  
      estimator = Estimator(model, optim_method, "")
      estimator.set_constant_gradient_clipping(0.1, 1.2)
      estimator.train(
          train_set=data_set,
          criterion=ClassNLLCriterion(),
          end_trigger=MaxEpoch(epoch_num),
          checkpoint_trigger=EveryEpoch(),
          validation_set=data_set,
          validation_method=[Top1Accuracy()],
          batch_size=batch_size,
      )
      eval_result = estimator.evaluate(
          validation_set=data_set, validation_method=[Top1Accuracy()]
      )
      assert isinstance(eval_result[0], EvaluatedResult)
      assert len(eval_result) == 1
      predict_result = model.predict(sample_rdd)
      assert (predict_result.count(), 8)
  
file_path: analytics-zoo/pyzoo/test/zoo/pipeline/estimator/test_estimator.py
imports: import pytest
  from pyspark.ml import Pipeline
  from zoo.pipeline.estimator import *
  from bigdl.nn.layer import Sequential, View, Linear, LogSoftMax, SpatialConvolution
  from bigdl.nn.criterion import ClassNLLCriterion
  from bigdl.optim.optimizer import *
  from bigdl.util.common import EvaluatedResult
  from test.zoo.pipeline.utils.test_utils import ZooTestCase
  from zoo.feature.common import FeatureSet
  from zoo import init_nncontext, init_spark_conf
  import zoo.common
label_desc: Use image node_id 6 for calling the TestEstimator obj's underlying member method code with example usage: obj.test_estimator_train() without return types