code: def to_labeled_point(
      sc: SparkContext,
      features: np.array,
      labels: np.array,
      categorical: bool = False,
  ):
      """Convert numpy arrays of features and labels into
      a LabeledPoint RDD for MLlib and ML integration.
  
      :param sc: Spark context
      :param features: numpy array with features
      :param labels: numpy array with labels
      :param categorical: boolean, whether labels are already one-hot encoded or not
      :return: LabeledPoint RDD with features and labels
      """
      labeled_points = []
      for x, y in zip(features, labels):
          if categorical:
              lp = LabeledPoint(np.argmax(y), to_vector(x))
          else:
              lp = LabeledPoint(y, to_vector(x))
          labeled_points.append(lp)
      return sc.parallelize(labeled_points)
  
file_path: elephas/elephas/utils/rdd_utils.py
imports: from pyspark import RDD, SparkContext
  from pyspark.mllib.regression import LabeledPoint
  import numpy
  from ..mllib.adapter import to_vector, from_vector
label_desc: Use image node_id 2 for calling a global function with example usage: to_labeled_point(sc, features, labels, categorical) and returns: sc