docstr: SparkMLlibModel
  
  The Spark MLlib model takes RDDs of LabeledPoints for training.
  
  :param model: Compiled Keras model
  :param mode: String, choose from `asynchronous`, `synchronous` and `hogwild`
  :param frequency: String, either `epoch` or `batch`
  :param parameter_server_mode: String, either `http` or `socket`
  :param num_workers: int, number of workers used for training (defaults to None)
  :param custom_objects: Keras custom objects
  :param batch_size: batch size used for training and inference
  :param port: port used in case of 'http' parameter server mode
docstr_tok: ["SparkMLlibModel","The","Spark","MLlib","model","takes","RDDs","of","LabeledPoints","for","training",".",":","param","model",":","Compiled","Keras","model",":","param","mode",":","String",",","choose","from","`","asynchronous","`",",","`","synchronous","`","and","`","hogwild","`",":","param","frequency",":","String",",","either","`","epoch","`","or","`","batch","`",":","param","parameter_server_mode",":","String",",","either","`","http","`","or","`","socket","`",":","param","num_workers",":","int",",","number","of","workers","used","for","training","(","defaults","to","None",")",":","param","custom_objects",":","Keras","custom","objects",":","param","batch_size",":","batch","size","used","for","training","and","inference",":","param","port",":","port","used","in","case","of","'http","'","parameter","server","mode"]
code: def __init__(
      self,
      model,
      mode="asynchronous",
      frequency="epoch",
      parameter_server_mode="http",
      num_workers=4,
      elephas_optimizer=None,
      custom_objects=None,
      batch_size=32,
      port=4000,
      *args,
      **kwargs,
  ):
      """SparkMLlibModel
  
      The Spark MLlib model takes RDDs of LabeledPoints for training.
  
      :param model: Compiled Keras model
      :param mode: String, choose from `asynchronous`, `synchronous` and `hogwild`
      :param frequency: String, either `epoch` or `batch`
      :param parameter_server_mode: String, either `http` or `socket`
      :param num_workers: int, number of workers used for training (defaults to None)
      :param custom_objects: Keras custom objects
      :param batch_size: batch size used for training and inference
      :param port: port used in case of 'http' parameter server mode
      """
      SparkModel.__init__(
          self,
          model=model,
          mode=mode,
          frequency=frequency,
          parameter_server_mode=parameter_server_mode,
          num_workers=num_workers,
          custom_objects=custom_objects,
          batch_size=batch_size,
          port=port,
          *args,
          **kwargs,
      )
  
imports: import json
  from functools import partial
  from itertools import tee
  from typing import Union
  import h5py
  import numpy
  import pyspark
  from pyspark import RDD
  from tensorflow.keras.models import load_model
  from tensorflow.keras.models import model_from_json
  from tensorflow.keras.optimizers import get
  from tensorflow.keras.optimizers import serialize, deserialize
  from .mllib import to_matrix, from_matrix, to_vector, from_vector
  from .parameter.factory import ClientServerFactory
  from .utils import lp_to_simple_rdd, to_simple_rdd
  from .utils import model_to_dict
  from .utils import subtract_params, divide_by
  from .worker import AsynchronousSparkWorker, SparkWorker
label_desc: Use image node_id 1 to create a new SparkMLlibModel object from inherited base classes: SparkModel with example: obj = SparkMLlibModel(model, mode, frequency, parameter_server_mode, num_workers, elephas_optimizer, custom_objects, batch_size, port)