docstr: Train an elephas model on an RDD. The Keras model configuration as specified
  in the elephas model is sent to Spark workers, abd each worker will be trained
  on their data partition.
  
  :param rdd: RDD with features and labels
  :param epochs: number of epochs used for training
  :param batch_size: batch size used for training
  :param verbose: logging verbosity level (0, 1 or 2)
  :param validation_split: percentage of data set aside for validation
docstr_tok: ["Train","an","elephas","model","on","an","RDD",".","The","Keras","model","configuration","as","specified","in","the","elephas","model","is","sent","to","Spark","workers",",","abd","each","worker","will","be","trained","on","their","data","partition",".",":","param","rdd",":","RDD","with","features","and","labels",":","param","epochs",":","number","of","epochs","used","for","training",":","param","batch_size",":","batch","size","used","for","training",":","param","verbose",":","logging","verbosity","level","(","0",",","1","or","2",")",":","param","validation_split",":","percentage","of","data","set","aside","for","validation"]
code: def fit(self, rdd: RDD, **kwargs):
      """
      Train an elephas model on an RDD. The Keras model configuration as specified
      in the elephas model is sent to Spark workers, abd each worker will be trained
      on their data partition.
  
      :param rdd: RDD with features and labels
      :param epochs: number of epochs used for training
      :param batch_size: batch size used for training
      :param verbose: logging verbosity level (0, 1 or 2)
      :param validation_split: percentage of data set aside for validation
      """
      print(">>> Fit model")
      if self.num_workers:
          rdd = rdd.repartition(self.num_workers)
  
      if self.mode in ["asynchronous", "synchronous", "hogwild"]:
          self._fit(rdd, **kwargs)
      else:
          raise ValueError(
              "Choose from one of the modes: asynchronous, synchronous or hogwild"
          )
  
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 11 for calling the SparkModel obj's underlying member method code with example usage: obj.fit(rdd) without return types