docstr: Construct an Estimator with BigDL model, loss function and Preprocessing for feature and
  label data.
  
  :param model: BigDL Model to be trained.
  :param loss: BigDL criterion.
  :param optimizer: BigDL optimizer.
  :param metrics: A evaluation metric or a list of evaluation metrics
  :param feature_preprocessing: Used when data in `fit` and `predict` is a Spark DataFrame.
         The param converts the data in feature column to a Tensor or to a Sample directly.
         It expects a List of Int as the size of the converted Tensor, or a Preprocessing[F,
         Tensor[T]]
  
         If a List of Int is set as feature_preprocessing, it can only handle the case that
         feature column contains the following data types:
         Float, Double, Int, Array[Float], Array[Double], Array[Int] and MLlib Vector. The
         feature data are converted to Tensors with the specified sizes before
         sending to the model. Internally, a SeqToTensor is generated according to the
         size, and used as the feature_preprocessing.
  
         Alternatively, user can set feature_preprocessing as Preprocessing[F, Tensor[T]]
         that transforms the feature data to a Tensor[T]. Some pre-defined Preprocessing are
         provided in package zoo.feature. Multiple Preprocessing can be combined as a
         ChainedPreprocessing.
  
         The feature_preprocessing will also be copied to the generated NNModel and applied
         to feature column during transform.
  :param label_preprocessing: Used when data in `fit` and `predict` is a Spark DataFrame.
         similar to feature_preprocessing, but applies to Label data.
  :param model_dir: The path to save model. During the training, if checkpoint_trigger is
         defined and triggered, the model will be saved to model_dir.
  :return:
docstr_tok: ["Construct","an","Estimator","with","BigDL","model",",","loss","function","and","Preprocessing","for","feature","and","label","data",".",":","param","model",":","BigDL","Model","to","be","trained",".",":","param","loss",":","BigDL","criterion",".",":","param","optimizer",":","BigDL","optimizer",".",":","param","metrics",":","A","evaluation","metric","or","a","list","of","evaluation","metrics",":","param","feature_preprocessing",":","Used","when","data","in","`","fit","`","and","`","predict","`","is","a","Spark","DataFrame",".","The","param","converts","the","data","in","feature","column","to","a","Tensor","or","to","a","Sample","directly",".","It","expects","a","List","of","Int","as","the","size","of","the","converted","Tensor",",","or","a","Preprocessing","[","F",",","Tensor","[","T","]","]","If","a","List","of","Int","is","set","as","feature_preprocessing",",","it","can","only","handle","the","case","that","feature","column","contains","the","following","data","types",":","Float",",","Double",",","Int",",","Array","[","Float","]",",","Array","[","Double","]",",","Array","[","Int","]","and","MLlib","Vector",".","The","feature","data","are","converted","to","Tensors","with","the","specified","sizes","before","sending","to","the","model",".","Internally",",","a","SeqToTensor","is","generated","according","to","the","size",",","and","used","as","the","feature_preprocessing",".","Alternatively",",","user","can","set","feature_preprocessing","as","Preprocessing","[","F",",","Tensor","[","T","]","]","that","transforms","the","feature","data","to","a","Tensor","[","T","]",".","Some","pre-defined","Preprocessing","are","provided","in","package","zoo.feature",".","Multiple","Preprocessing","can","be","combined","as","a","ChainedPreprocessing",".","The","feature_preprocessing","will","also","be","copied","to","the","generated","NNModel","and","applied","to","feature","column","during","transform",".",":","param","label_preprocessing",":","Used","when","data","in","`","fit","`","and","`","predict","`","is","a","Spark","DataFrame",".","similar","to","feature_preprocessing",",","but","applies","to","Label","data",".",":","param","model_dir",":","The","path","to","save","model",".","During","the","training",",","if","checkpoint_trigger","is","defined","and","triggered",",","the","model","will","be","saved","to","model_dir",".",":","return",":"]
code: def from_bigdl(
      *,
      model,
      loss=None,
      optimizer=None,
      metrics=None,
      feature_preprocessing=None,
      label_preprocessing=None,
      model_dir=None,
  ):
      """
      Construct an Estimator with BigDL model, loss function and Preprocessing for feature and
      label data.
  
      :param model: BigDL Model to be trained.
      :param loss: BigDL criterion.
      :param optimizer: BigDL optimizer.
      :param metrics: A evaluation metric or a list of evaluation metrics
      :param feature_preprocessing: Used when data in `fit` and `predict` is a Spark DataFrame.
             The param converts the data in feature column to a Tensor or to a Sample directly.
             It expects a List of Int as the size of the converted Tensor, or a Preprocessing[F,
             Tensor[T]]
  
             If a List of Int is set as feature_preprocessing, it can only handle the case that
             feature column contains the following data types:
             Float, Double, Int, Array[Float], Array[Double], Array[Int] and MLlib Vector. The
             feature data are converted to Tensors with the specified sizes before
             sending to the model. Internally, a SeqToTensor is generated according to the
             size, and used as the feature_preprocessing.
  
             Alternatively, user can set feature_preprocessing as Preprocessing[F, Tensor[T]]
             that transforms the feature data to a Tensor[T]. Some pre-defined Preprocessing are
             provided in package zoo.feature. Multiple Preprocessing can be combined as a
             ChainedPreprocessing.
  
             The feature_preprocessing will also be copied to the generated NNModel and applied
             to feature column during transform.
      :param label_preprocessing: Used when data in `fit` and `predict` is a Spark DataFrame.
             similar to feature_preprocessing, but applies to Label data.
      :param model_dir: The path to save model. During the training, if checkpoint_trigger is
             defined and triggered, the model will be saved to model_dir.
      :return:
      """
      return BigDLEstimator(
          model=model,
          loss=loss,
          optimizer=optimizer,
          metrics=metrics,
          feature_preprocessing=feature_preprocessing,
          label_preprocessing=label_preprocessing,
          model_dir=model_dir,
      )
  
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 1 for calling the Estimator obj's underlying member method code with example usage: obj.from_bigdl() and returns: BigDLEstimator