class_docstr: Train a classification model for Multinomial/Binary Logistic Regression
  using Limited-memory BFGS.
  
  Standard feature scaling and L2 regularization are used by default.
  .. versionadded:: 1.2.0
class_docstr_tok: ["Train","a","classification","model","for","Multinomial\/Binary","Logistic","Regression","using","Limited-memory","BFGS",".","Standard","feature","scaling","and","L2","regularization","are","used","by","default",".","..","versionadded",":",":","1.2.0"]
docstr: Train a logistic regression model on the given data.
  
  .. versionadded:: 1.2.0
  
  Parameters
  ----------
  data : :py:class:`pyspark.RDD`
      The training data, an RDD of :py:class:`pyspark.mllib.regression.LabeledPoint`.
  iterations : int, optional
      The number of iterations.
      (default: 100)
  initialWeights : :py:class:`pyspark.mllib.linalg.Vector` or convertible, optional
      The initial weights.
      (default: None)
  regParam : float, optional
      The regularizer parameter.
      (default: 0.01)
  regType : str, optional
      The type of regularizer used for training our model.
      Supported values:
  
      - "l1" for using L1 regularization
      - "l2" for using L2 regularization (default)
      - None for no regularization
  
  intercept : bool, optional
      Boolean parameter which indicates the use or not of the
      augmented representation for training data (i.e., whether bias
      features are activated or not).
      (default: False)
  corrections : int, optional
      The number of corrections used in the LBFGS update.
      If a known updater is used for binary classification,
      it calls the ml implementation and this parameter will
      have no effect. (default: 10)
  tolerance : float, optional
      The convergence tolerance of iterations for L-BFGS.
      (default: 1e-6)
  validateData : bool, optional
      Boolean parameter which indicates if the algorithm should
      validate data before training.
      (default: True)
  numClasses : int, optional
      The number of classes (i.e., outcomes) a label can take in
      Multinomial Logistic Regression.
      (default: 2)
  
  Examples
  --------
  >>> data = [
  ...     LabeledPoint(0.0, [0.0, 1.0]),
  ...     LabeledPoint(1.0, [1.0, 0.0]),
  ... ]
  >>> lrm = LogisticRegressionWithLBFGS.train(sc.parallelize(data), iterations=10)
  >>> lrm.predict([1.0, 0.0])
  1
  >>> lrm.predict([0.0, 1.0])
  0
docstr_tok: ["Train","a","logistic","regression","model","on","the","given","data",".","..","versionadded",":",":","1.2.0","Parameters","--","--","--","--","--","data",":",":","py",":","class",":","`","pyspark.RDD","`","The","training","data",",","an","RDD","of",":","py",":","class",":","`","pyspark.mllib.regression.LabeledPoint","`",".","iterations",":","int",",","optional","The","number","of","iterations",".","(","default",":","100",")","initialWeights",":",":","py",":","class",":","`","pyspark.mllib.linalg.Vector","`","or","convertible",",","optional","The","initial","weights",".","(","default",":","None",")","regParam",":","float",",","optional","The","regularizer","parameter",".","(","default",":","0.01",")","regType",":","str",",","optional","The","type","of","regularizer","used","for","training","our","model",".","Supported","values",":","-","``","l1","''","for","using","L1","regularization","-","``","l2","''","for","using","L2","regularization","(","default",")","-","None","for","no","regularization","intercept",":","bool",",","optional","Boolean","parameter","which","indicates","the","use","or","not","of","the","augmented","representation","for","training","data","(","i.e.",",","whether","bias","features","are","activated","or","not",")",".","(","default",":","False",")","corrections",":","int",",","optional","The","number","of","corrections","used","in","the","LBFGS","update",".","If","a","known","updater","is","used","for","binary","classification",",","it","calls","the","ml","implementation","and","this","parameter","will","have","no","effect",".","(","default",":","10",")","tolerance",":","float",",","optional","The","convergence","tolerance","of","iterations","for","L-BFGS",".","(","default",":","1e-6",")","validateData",":","bool",",","optional","Boolean","parameter","which","indicates","if","the","algorithm","should","validate","data","before","training",".","(","default",":","True",")","numClasses",":","int",",","optional","The","number","of","classes","(","i.e.",",","outcomes",")","a","label","can","take","in","Multinomial","Logistic","Regression",".","(","default",":","2",")","Examples","--","--","--","--",">",">",">","data","=","[","...","LabeledPoint","(","0.0",",","[","0.0",",","1.0","]",")",",","...","LabeledPoint","(","1.0",",","[","1.0",",","0.0","]",")",",","...","]",">",">",">","lrm","=","LogisticRegressionWithLBFGS.train","(","sc.parallelize","(","data",")",",","iterations=10",")",">",">",">","lrm.predict","(","[","1.0",",","0.0","]",")","1",">",">",">","lrm.predict","(","[","0.0",",","1.0","]",")","0"]
code: def train(
      cls,
      data: RDD[LabeledPoint],
      iterations: int = 100,
      initialWeights: Optional["VectorLike"] = None,
      regParam: float = 0.0,
      regType: str = "l2",
      intercept: bool = False,
      corrections: int = 10,
      tolerance: float = 1e-6,
      validateData: bool = True,
      numClasses: int = 2,
  ) -> LogisticRegressionModel:
      """
      Train a logistic regression model on the given data.
  
      .. versionadded:: 1.2.0
  
      Parameters
      ----------
      data : :py:class:`pyspark.RDD`
          The training data, an RDD of :py:class:`pyspark.mllib.regression.LabeledPoint`.
      iterations : int, optional
          The number of iterations.
          (default: 100)
      initialWeights : :py:class:`pyspark.mllib.linalg.Vector` or convertible, optional
          The initial weights.
          (default: None)
      regParam : float, optional
          The regularizer parameter.
          (default: 0.01)
      regType : str, optional
          The type of regularizer used for training our model.
          Supported values:
  
          - "l1" for using L1 regularization
          - "l2" for using L2 regularization (default)
          - None for no regularization
  
      intercept : bool, optional
          Boolean parameter which indicates the use or not of the
          augmented representation for training data (i.e., whether bias
          features are activated or not).
          (default: False)
      corrections : int, optional
          The number of corrections used in the LBFGS update.
          If a known updater is used for binary classification,
          it calls the ml implementation and this parameter will
          have no effect. (default: 10)
      tolerance : float, optional
          The convergence tolerance of iterations for L-BFGS.
          (default: 1e-6)
      validateData : bool, optional
          Boolean parameter which indicates if the algorithm should
          validate data before training.
          (default: True)
      numClasses : int, optional
          The number of classes (i.e., outcomes) a label can take in
          Multinomial Logistic Regression.
          (default: 2)
  
      Examples
      --------
      >>> data = [
      ...     LabeledPoint(0.0, [0.0, 1.0]),
      ...     LabeledPoint(1.0, [1.0, 0.0]),
      ... ]
      >>> lrm = LogisticRegressionWithLBFGS.train(sc.parallelize(data), iterations=10)
      >>> lrm.predict([1.0, 0.0])
      1
      >>> lrm.predict([0.0, 1.0])
      0
      """
  
      def train(rdd: RDD[LabeledPoint], i: Vector) -> Iterable[Any]:
          return callMLlibFunc(
              "trainLogisticRegressionModelWithLBFGS",
              rdd,
              int(iterations),
              i,
              float(regParam),
              regType,
              bool(intercept),
              int(corrections),
              float(tolerance),
              bool(validateData),
              int(numClasses),
          )
  
      if initialWeights is None:
          if numClasses == 2:
              initialWeights = [0.0] * len(data.first().features)
          else:
              if intercept:
                  initialWeights = (
                      [0.0]
                      * (len(data.first().features) + 1)
                      * (numClasses - 1)
                  )
              else:
                  initialWeights = (
                      [0.0]
                      * len(data.first().features)
                      * (numClasses - 1)
                  )
      return _regression_train_wrapper(
          train, LogisticRegressionModel, data, initialWeights
      )
  
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 1 for calling the LogisticRegressionWithLBFGS obj's underlying member method code with example usage: obj.train(cls, data, iterations, initialWeights, regParam, regType, intercept, corrections, tolerance, validateData, numClasses) and returns: _regression_train_wrapper, callMLlibFunc