docstr: Predict input data
  
  :param data: predict input data. It can be XShards or Spark DataFrame.
         If data is XShards, each partition is a dictionary of  {'x': feature}, where feature
         is a numpy array or a list of numpy arrays.
  :param batch_size: Batch size used for inference. Default: 4.
  :param feature_cols: Feature column name(s) of data. Only used when data is a Spark
         DataFrame. Default: "features".
  :param sample_preprocessing: Used when data is a Spark DataFrame. If the user want change
         the default feature_preprocessing specified in Estimator.from_bigdl, the user can
         pass the new sample_preprocessing methods.
  :return: predicted result.
           If input data is Spark DataFrame, the predict result is a DataFrame which includes
           original columns plus 'prediction' column. The 'prediction' column can be
           FloatType, VectorUDT or Array of VectorUDT depending on model outputs shape.
           If input data is an XShards, the predict result is a XShards, each partition
           of the XShards is a dictionary of {'prediction': result}, where result is a numpy
           array or a list of numpy arrays.
docstr_tok: ["Predict","input","data",":","param","data",":","predict","input","data",".","It","can","be","XShards","or","Spark","DataFrame",".","If","data","is","XShards",",","each","partition","is","a","dictionary","of","{","'","x","'",":","feature","}",",","where","feature","is","a","numpy","array","or","a","list","of","numpy","arrays",".",":","param","batch_size",":","Batch","size","used","for","inference",".","Default",":","4.",":","param","feature_cols",":","Feature","column","name","(","s",")","of","data",".","Only","used","when","data","is","a","Spark","DataFrame",".","Default",":","``","features","''",".",":","param","sample_preprocessing",":","Used","when","data","is","a","Spark","DataFrame",".","If","the","user","want","change","the","default","feature_preprocessing","specified","in","Estimator.from_bigdl",",","the","user","can","pass","the","new","sample_preprocessing","methods",".",":","return",":","predicted","result",".","If","input","data","is","Spark","DataFrame",",","the","predict","result","is","a","DataFrame","which","includes","original","columns","plus","'prediction","'","column",".","The","'prediction","'","column","can","be","FloatType",",","VectorUDT","or","Array","of","VectorUDT","depending","on","model","outputs","shape",".","If","input","data","is","an","XShards",",","the","predict","result","is","a","XShards",",","each","partition","of","the","XShards","is","a","dictionary","of","{","'prediction","'",":","result","}",",","where","result","is","a","numpy","array","or","a","list","of","numpy","arrays","."]
code: def predict(
      self,
      data,
      batch_size=4,
      feature_cols="features",
      sample_preprocessing=None,
  ):
      """
      Predict input data
  
      :param data: predict input data. It can be XShards or Spark DataFrame.
             If data is XShards, each partition is a dictionary of  {'x': feature}, where feature
             is a numpy array or a list of numpy arrays.
      :param batch_size: Batch size used for inference. Default: 4.
      :param feature_cols: Feature column name(s) of data. Only used when data is a Spark
             DataFrame. Default: "features".
      :param sample_preprocessing: Used when data is a Spark DataFrame. If the user want change
             the default feature_preprocessing specified in Estimator.from_bigdl, the user can
             pass the new sample_preprocessing methods.
      :return: predicted result.
               If input data is Spark DataFrame, the predict result is a DataFrame which includes
               original columns plus 'prediction' column. The 'prediction' column can be
               FloatType, VectorUDT or Array of VectorUDT depending on model outputs shape.
               If input data is an XShards, the predict result is a XShards, each partition
               of the XShards is a dictionary of {'prediction': result}, where result is a numpy
               array or a list of numpy arrays.
      """
      if isinstance(data, DataFrame):
          if isinstance(feature_cols, list):
              data, _, feature_cols = BigDLEstimator._combine_cols(
                  data, feature_cols, col_name="features"
              )
          self.nn_model.setBatchSize(batch_size).setFeaturesCol(
              feature_cols
          )
          if sample_preprocessing is not None:
              self.nn_model.setSamplePreprocessing(sample_preprocessing)
          return self.nn_model.transform(data)
      elif isinstance(data, SparkXShards):
          from zoo.orca.data.utils import xshard_to_sample
          from zoo.orca.learn.utils import convert_predict_rdd_to_xshard
  
          sample_rdd = data.rdd.flatMap(xshard_to_sample)
          result_rdd = self.model.predict(sample_rdd)
          return convert_predict_rdd_to_xshard(data, result_rdd)
      else:
          raise ValueError(
              "Data should be XShards or Spark DataFrame, but get "
              + data.__class__.__name__
          )
  
imports: from zoo.orca.learn.metrics import Metric
  from zoo.orca.learn.utils import bigdl_metric_results_to_dict
  from zoo.pipeline.nnframes import NNEstimator, NNModel
  from zoo.pipeline.estimator import Estimator
  from zoo.orca.learn.spark_estimator import Estimator
  from zoo.orca.data import SparkXShards
  from bigdl.optim.optimizer import MaxEpoch
  from zoo.feature.common import FeatureSet
  from zoo.orca.learn.metrics import Accuracy
  from pyspark.sql.dataframe import DataFrame
label_desc: Use image node_id 3 for calling the BigDLEstimator obj's underlying member method code with example usage: obj.predict(data, batch_size, feature_cols, sample_preprocessing) and returns: self, convert_predict_rdd_to_xshard