class_docstr: Classification model trained using Multinomial/Binary Logistic
  Regression.
  
  .. versionadded:: 0.9.0
  
  Parameters
  ----------
  weights : :py:class:`pyspark.mllib.linalg.Vector`
      Weights computed for every feature.
  intercept : float
      Intercept computed for this model. (Only used in Binary Logistic
      Regression. In Multinomial Logistic Regression, the intercepts will
      not be a single value, so the intercepts will be part of the
      weights.)
  numFeatures : int
      The dimension of the features.
  numClasses : int
      The number of possible outcomes for k classes classification problem
      in Multinomial Logistic Regression. By default, it is binary
      logistic regression so numClasses will be set to 2.
  
  Examples
  --------
  >>> from pyspark.mllib.linalg import SparseVector
  >>> data = [
  ...     LabeledPoint(0.0, [0.0, 1.0]),
  ...     LabeledPoint(1.0, [1.0, 0.0]),
  ... ]
  >>> lrm = LogisticRegressionWithSGD.train(sc.parallelize(data), iterations=10)
  >>> lrm.predict([1.0, 0.0])
  1
  >>> lrm.predict([0.0, 1.0])
  0
  >>> lrm.predict(sc.parallelize([[1.0, 0.0], [0.0, 1.0]])).collect()
  [1, 0]
  >>> lrm.clearThreshold()
  >>> lrm.predict([0.0, 1.0])
  0.279...
  
  >>> sparse_data = [
  ...     LabeledPoint(0.0, SparseVector(2, {0: 0.0})),
  ...     LabeledPoint(1.0, SparseVector(2, {1: 1.0})),
  ...     LabeledPoint(0.0, SparseVector(2, {0: 1.0})),
  ...     LabeledPoint(1.0, SparseVector(2, {1: 2.0}))
  ... ]
  >>> lrm = LogisticRegressionWithSGD.train(sc.parallelize(sparse_data), iterations=10)
  >>> lrm.predict(numpy.array([0.0, 1.0]))
  1
  >>> lrm.predict(numpy.array([1.0, 0.0]))
  0
  >>> lrm.predict(SparseVector(2, {1: 1.0}))
  1
  >>> lrm.predict(SparseVector(2, {0: 1.0}))
  0
  >>> import os, tempfile
  >>> path = tempfile.mkdtemp()
  >>> lrm.save(sc, path)
  >>> sameModel = LogisticRegressionModel.load(sc, path)
  >>> sameModel.predict(numpy.array([0.0, 1.0]))
  1
  >>> sameModel.predict(SparseVector(2, {0: 1.0}))
  0
  >>> from shutil import rmtree
  >>> try:
  ...    rmtree(path)
  ... except BaseException:
  ...    pass
  >>> multi_class_data = [
  ...     LabeledPoint(0.0, [0.0, 1.0, 0.0]),
  ...     LabeledPoint(1.0, [1.0, 0.0, 0.0]),
  ...     LabeledPoint(2.0, [0.0, 0.0, 1.0])
  ... ]
  >>> data = sc.parallelize(multi_class_data)
  >>> mcm = LogisticRegressionWithLBFGS.train(data, iterations=10, numClasses=3)
  >>> mcm.predict([0.0, 0.5, 0.0])
  0
  >>> mcm.predict([0.8, 0.0, 0.0])
  1
  >>> mcm.predict([0.0, 0.0, 0.3])
  2
class_docstr_tok: ["Classification","model","trained","using","Multinomial\/Binary","Logistic","Regression",".","..","versionadded",":",":","0.9.0","Parameters","--","--","--","--","--","weights",":",":","py",":","class",":","`","pyspark.mllib.linalg.Vector","`","Weights","computed","for","every","feature",".","intercept",":","float","Intercept","computed","for","this","model",".","(","Only","used","in","Binary","Logistic","Regression",".","In","Multinomial","Logistic","Regression",",","the","intercepts","will","not","be","a","single","value",",","so","the","intercepts","will","be","part","of","the","weights",".",")","numFeatures",":","int","The","dimension","of","the","features",".","numClasses",":","int","The","number","of","possible","outcomes","for","k","classes","classification","problem","in","Multinomial","Logistic","Regression",".","By","default",",","it","is","binary","logistic","regression","so","numClasses","will","be","set","to","2",".","Examples","--","--","--","--",">",">",">","from","pyspark.mllib.linalg","import","SparseVector",">",">",">","data","=","[","...","LabeledPoint","(","0.0",",","[","0.0",",","1.0","]",")",",","...","LabeledPoint","(","1.0",",","[","1.0",",","0.0","]",")",",","...","]",">",">",">","lrm","=","LogisticRegressionWithSGD.train","(","sc.parallelize","(","data",")",",","iterations=10",")",">",">",">","lrm.predict","(","[","1.0",",","0.0","]",")","1",">",">",">","lrm.predict","(","[","0.0",",","1.0","]",")","0",">",">",">","lrm.predict","(","sc.parallelize","(","[","[","1.0",",","0.0","]",",","[","0.0",",","1.0","]","]",")",")",".collect","(",")","[","1",",","0","]",">",">",">","lrm.clearThreshold","(",")",">",">",">","lrm.predict","(","[","0.0",",","1.0","]",")","0.279","...",">",">",">","sparse_data","=","[","...","LabeledPoint","(","0.0",",","SparseVector","(","2",",","{","0",":","0.0","}",")",")",",","...","LabeledPoint","(","1.0",",","SparseVector","(","2",",","{","1",":","1.0","}",")",")",",","...","LabeledPoint","(","0.0",",","SparseVector","(","2",",","{","0",":","1.0","}",")",")",",","...","LabeledPoint","(","1.0",",","SparseVector","(","2",",","{","1",":","2.0","}",")",")","...","]",">",">",">","lrm","=","LogisticRegressionWithSGD.train","(","sc.parallelize","(","sparse_data",")",",","iterations=10",")",">",">",">","lrm.predict","(","numpy.array","(","[","0.0",",","1.0","]",")",")","1",">",">",">","lrm.predict","(","numpy.array","(","[","1.0",",","0.0","]",")",")","0",">",">",">","lrm.predict","(","SparseVector","(","2",",","{","1",":","1.0","}",")",")","1",">",">",">","lrm.predict","(","SparseVector","(","2",",","{","0",":","1.0","}",")",")","0",">",">",">","import","os",",","tempfile",">",">",">","path","=","tempfile.mkdtemp","(",")",">",">",">","lrm.save","(","sc",",","path",")",">",">",">","sameModel","=","LogisticRegressionModel.load","(","sc",",","path",")",">",">",">","sameModel.predict","(","numpy.array","(","[","0.0",",","1.0","]",")",")","1",">",">",">","sameModel.predict","(","SparseVector","(","2",",","{","0",":","1.0","}",")",")","0",">",">",">","from","shutil","import","rmtree",">",">",">","try",":","...","rmtree","(","path",")","...","except","BaseException",":","...","pass",">",">",">","multi_class_data","=","[","...","LabeledPoint","(","0.0",",","[","0.0",",","1.0",",","0.0","]",")",",","...","LabeledPoint","(","1.0",",","[","1.0",",","0.0",",","0.0","]",")",",","...","LabeledPoint","(","2.0",",","[","0.0",",","0.0",",","1.0","]",")","...","]",">",">",">","data","=","sc.parallelize","(","multi_class_data",")",">",">",">","mcm","=","LogisticRegressionWithLBFGS.train","(","data",",","iterations=10",",","numClasses=3",")",">",">",">","mcm.predict","(","[","0.0",",","0.5",",","0.0","]",")","0",">",">",">","mcm.predict","(","[","0.8",",","0.0",",","0.0","]",")","1",">",">",">","mcm.predict","(","[","0.0",",","0.0",",","0.3","]",")","2"]
code: def __repr__(self) -> str:
      return (
          "pyspark.mllib.LogisticRegressionModel: intercept = {}, "
          "numFeatures = {}, numClasses = {}, threshold = {}"
      ).format(
          self._intercept,
          self._numFeatures,
          self._numClasses,
          self._threshold,
      )
  
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 9 for calling the LogisticRegressionModel obj's underlying member method code with example usage: obj.__repr__() and returns: str