class_docstr: Train or predict a logistic regression model on streaming data.
  Training uses Stochastic Gradient Descent to update the model based on
  each new batch of incoming data from a DStream.
  
  Each batch of data is assumed to be an RDD of LabeledPoints.
  The number of data points per batch can vary, but the number
  of features must be constant. An initial weight
  vector must be provided.
  
  .. versionadded:: 1.5.0
  
  Parameters
  ----------
  stepSize : float, optional
      Step size for each iteration of gradient descent.
      (default: 0.1)
  numIterations : int, optional
      Number of iterations run for each batch of data.
      (default: 50)
  miniBatchFraction : float, optional
      Fraction of each batch of data to use for updates.
      (default: 1.0)
  regParam : float, optional
      L2 Regularization parameter.
      (default: 0.0)
  convergenceTol : float, optional
      Value used to determine when to terminate iterations.
      (default: 0.001)
class_docstr_tok: ["Train","or","predict","a","logistic","regression","model","on","streaming","data",".","Training","uses","Stochastic","Gradient","Descent","to","update","the","model","based","on","each","new","batch","of","incoming","data","from","a","DStream",".","Each","batch","of","data","is","assumed","to","be","an","RDD","of","LabeledPoints",".","The","number","of","data","points","per","batch","can","vary",",","but","the","number","of","features","must","be","constant",".","An","initial","weight","vector","must","be","provided",".","..","versionadded",":",":","1.5.0","Parameters","--","--","--","--","--","stepSize",":","float",",","optional","Step","size","for","each","iteration","of","gradient","descent",".","(","default",":","0.1",")","numIterations",":","int",",","optional","Number","of","iterations","run","for","each","batch","of","data",".","(","default",":","50",")","miniBatchFraction",":","float",",","optional","Fraction","of","each","batch","of","data","to","use","for","updates",".","(","default",":","1.0",")","regParam",":","float",",","optional","L2","Regularization","parameter",".","(","default",":","0.0",")","convergenceTol",":","float",",","optional","Value","used","to","determine","when","to","terminate","iterations",".","(","default",":","0.001",")"]
docstr: Train the model on the incoming dstream.
docstr_tok: ["Train","the","model","on","the","incoming","dstream","."]
code: def trainOn(self, dstream: "DStream[LabeledPoint]") -> None:
      """Train the model on the incoming dstream."""
      self._validate(dstream)
  
      def update(rdd: RDD[LabeledPoint]) -> None:
          # LogisticRegressionWithSGD.train raises an error for an empty RDD.
          if not rdd.isEmpty():
              self._model = LogisticRegressionWithSGD.train(
                  rdd,
                  self.numIterations,
                  self.stepSize,
                  self.miniBatchFraction,
                  self._model.weights,  # type: ignore[union-attr]
                  regParam=self.regParam,
                  convergenceTol=self.convergenceTol,
              )
  
      dstream.foreachRDD(update)
  
imports: from math import exp
  import sys
  import warnings
  from typing import Any, Iterable, Optional, Union, overload, TYPE_CHECKING
  import numpy
  from pyspark import RDD, SparkContext, since
  from pyspark.streaming.dstream import DStream
  from pyspark.mllib.common import callMLlibFunc, _py2java, _java2py
  from pyspark.mllib.linalg import _convert_to_vector
  from pyspark.mllib.regression import LabeledPoint, LinearModel, _regression_train_wrapper, StreamingLinearAlgorithm
  from pyspark.mllib.util import Saveable, Loader, inherit_doc
  from pyspark.mllib.linalg import Vector
  from pyspark.mllib.regression import LabeledPoint
label_desc: Use image node_id 3 for calling the StreamingLogisticRegressionWithSGD obj's underlying member method code with example usage: obj.trainOn(dstream) without return types