code: def to_labeled_point(sc, features, labels, categorical=False):
      
      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)
docs: 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