org.apache.spark.ml.classification

LogisticRegression

class LogisticRegression extends ProbabilisticClassifier[Vector, LogisticRegression, LogisticRegressionModel] with LogisticRegressionParams

:: AlphaComponent ::

Logistic regression. Currently, this class only supports binary classification.

Annotations
@AlphaComponent()
Linear Supertypes
LogisticRegressionParams, HasThreshold, HasMaxIter, HasRegParam, ProbabilisticClassifier[Vector, LogisticRegression, LogisticRegressionModel], ProbabilisticClassifierParams, HasProbabilityCol, Classifier[Vector, LogisticRegression, LogisticRegressionModel], ClassifierParams, HasRawPredictionCol, Predictor[Vector, LogisticRegression, LogisticRegressionModel], PredictorParams, HasPredictionCol, HasFeaturesCol, HasLabelCol, Estimator[LogisticRegressionModel], Params, Identifiable, PipelineStage, Logging, Serializable, Serializable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By inheritance
Inherited
  1. LogisticRegression
  2. LogisticRegressionParams
  3. HasThreshold
  4. HasMaxIter
  5. HasRegParam
  6. ProbabilisticClassifier
  7. ProbabilisticClassifierParams
  8. HasProbabilityCol
  9. Classifier
  10. ClassifierParams
  11. HasRawPredictionCol
  12. Predictor
  13. PredictorParams
  14. HasPredictionCol
  15. HasFeaturesCol
  16. HasLabelCol
  17. Estimator
  18. Params
  19. Identifiable
  20. PipelineStage
  21. Logging
  22. Serializable
  23. Serializable
  24. AnyRef
  25. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LogisticRegression()

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def addOutputColumn(schema: StructType, colName: String, dataType: DataType): StructType

    Attributes
    protected
    Definition Classes
    Params
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def checkInputColumn(schema: StructType, colName: String, dataType: DataType): Unit

    Check whether the given schema contains an input column.

    Check whether the given schema contains an input column.

    colName

    Parameter name for the input column.

    dataType

    SQL DataType of the input column.

    Attributes
    protected
    Definition Classes
    Params
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def explainParams(): String

    Returns the documentation of all params.

    Returns the documentation of all params.

    Definition Classes
    Params
  13. def extractLabeledPoints(dataset: DataFrame, paramMap: ParamMap): RDD[LabeledPoint]

    Extract labelCol and featuresCol from the given dataset, and put it in an RDD with strong types.

    Extract labelCol and featuresCol from the given dataset, and put it in an RDD with strong types.

    Attributes
    protected
    Definition Classes
    Predictor
  14. val featuresCol: Param[String]

    param for features column name

    param for features column name

    Definition Classes
    HasFeaturesCol
  15. def featuresDataType: DataType

    :: DeveloperApi ::

    :: DeveloperApi ::

    Returns the SQL DataType corresponding to the FeaturesType type parameter.

    This is used by validateAndTransformSchema(). This workaround is needed since SQL has different APIs for Scala and Java.

    The default value is VectorUDT, but it may be overridden if FeaturesType is not Vector.

    Attributes
    protected
    Definition Classes
    Predictor
    Annotations
    @DeveloperApi()
  16. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def fit(dataset: DataFrame, paramMap: ParamMap): LogisticRegressionModel

    Fits a single model to the input data with provided parameter map.

    Fits a single model to the input data with provided parameter map.

    dataset

    input dataset

    paramMap

    Parameter map. These values override any specified in this Estimator's embedded ParamMap.

    returns

    fitted model

    Definition Classes
    Predictor → Estimator
  18. def fit(dataset: DataFrame, paramMaps: Array[ParamMap]): Seq[LogisticRegressionModel]

    Fits multiple models to the input data with multiple sets of parameters.

    Fits multiple models to the input data with multiple sets of parameters. The default implementation uses a for loop on each parameter map. Subclasses could overwrite this to optimize multi-model training.

    dataset

    input dataset

    paramMaps

    An array of parameter maps. These values override any specified in this Estimator's embedded ParamMap.

    returns

    fitted models, matching the input parameter maps

    Definition Classes
    Estimator
  19. def fit(dataset: DataFrame, paramPairs: ParamPair[_]*): LogisticRegressionModel

    Fits a single model to the input data with optional parameters.

    Fits a single model to the input data with optional parameters.

    dataset

    input dataset

    paramPairs

    Optional list of param pairs. These values override any specified in this Estimator's embedded ParamMap.

    returns

    fitted model

    Definition Classes
    Estimator
    Annotations
    @varargs()
  20. def get[T](param: Param[T]): T

    Gets the value of a parameter in the embedded param map.

    Gets the value of a parameter in the embedded param map.

    Attributes
    protected
    Definition Classes
    Params
  21. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  22. def getFeaturesCol: String

    Definition Classes
    HasFeaturesCol
  23. def getLabelCol: String

    Definition Classes
    HasLabelCol
  24. def getMaxIter: Int

    Definition Classes
    HasMaxIter
  25. def getPredictionCol: String

    Definition Classes
    HasPredictionCol
  26. def getProbabilityCol: String

    Definition Classes
    HasProbabilityCol
  27. def getRawPredictionCol: String

    Definition Classes
    HasRawPredictionCol
  28. def getRegParam: Double

    Definition Classes
    HasRegParam
  29. def getThreshold: Double

    Definition Classes
    HasThreshold
  30. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  31. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  32. def isSet(param: Param[_]): Boolean

    Checks whether a param is explicitly set.

    Checks whether a param is explicitly set.

    Definition Classes
    Params
  33. def isTraceEnabled(): Boolean

    Attributes
    protected
    Definition Classes
    Logging
  34. val labelCol: Param[String]

    param for label column name

    param for label column name

    Definition Classes
    HasLabelCol
  35. def log: Logger

    Attributes
    protected
    Definition Classes
    Logging
  36. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  37. def logDebug(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  38. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  39. def logError(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  40. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  41. def logInfo(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  42. def logName: String

    Attributes
    protected
    Definition Classes
    Logging
  43. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  44. def logTrace(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  45. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  46. def logWarning(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  47. val maxIter: IntParam

    param for max number of iterations

    param for max number of iterations

    Definition Classes
    HasMaxIter
  48. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  49. final def notify(): Unit

    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  51. val paramMap: ParamMap

    Internal param map.

    Internal param map.

    Attributes
    protected
    Definition Classes
    Params
  52. def params: Array[Param[_]]

    Returns all params.

    Returns all params.

    Definition Classes
    Params
  53. val predictionCol: Param[String]

    param for prediction column name

    param for prediction column name

    Definition Classes
    HasPredictionCol
  54. val probabilityCol: Param[String]

    param for predicted class conditional probabilities column name

    param for predicted class conditional probabilities column name

    Definition Classes
    HasProbabilityCol
  55. val rawPredictionCol: Param[String]

    param for raw prediction column name

    param for raw prediction column name

    Definition Classes
    HasRawPredictionCol
  56. val regParam: DoubleParam

    param for regularization parameter

    param for regularization parameter

    Definition Classes
    HasRegParam
  57. def set[T](param: Param[T], value: T): LogisticRegression.this.type

    Sets a parameter in the embedded param map.

    Sets a parameter in the embedded param map.

    Attributes
    protected
    Definition Classes
    Params
  58. def setFeaturesCol(value: String): LogisticRegression

    Definition Classes
    Predictor
  59. def setLabelCol(value: String): LogisticRegression

    Definition Classes
    Predictor
  60. def setMaxIter(value: Int): LogisticRegression.this.type

  61. def setPredictionCol(value: String): LogisticRegression

    Definition Classes
    Predictor
  62. def setProbabilityCol(value: String): LogisticRegression

    Definition Classes
    ProbabilisticClassifier
  63. def setRawPredictionCol(value: String): LogisticRegression

    Definition Classes
    Classifier
  64. def setRegParam(value: Double): LogisticRegression.this.type

  65. def setThreshold(value: Double): LogisticRegression.this.type

  66. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  67. val threshold: DoubleParam

    param for threshold in (binary) prediction

    param for threshold in (binary) prediction

    Definition Classes
    HasThreshold
  68. def toString(): String

    Definition Classes
    AnyRef → Any
  69. def train(dataset: DataFrame, paramMap: ParamMap): LogisticRegressionModel

    :: DeveloperApi ::

    :: DeveloperApi ::

    Train a model using the given dataset and parameters. Developers can implement this instead of fit() to avoid dealing with schema validation and copying parameters into the model.

    dataset

    Training dataset

    paramMap

    Parameter map. Unlike fit()'s paramMap, this paramMap has already been combined with the embedded ParamMap.

    returns

    Fitted model

    Attributes
    protected
    Definition Classes
    LogisticRegression → Predictor
  70. def transformSchema(schema: StructType, paramMap: ParamMap): StructType

    :: DeveloperApi ::

    :: DeveloperApi ::

    Derives the output schema from the input schema and parameters. The schema describes the columns and types of the data.

    schema

    Input schema to this stage

    paramMap

    Parameters passed to this stage

    returns

    Output schema from this stage

    Definition Classes
    Predictor → PipelineStage
  71. def transformSchema(schema: StructType, paramMap: ParamMap, logging: Boolean): StructType

    Derives the output schema from the input schema and parameters, optionally with logging.

    Derives the output schema from the input schema and parameters, optionally with logging.

    Attributes
    protected
    Definition Classes
    PipelineStage
  72. def validate(): Unit

    Validates parameter values stored internally.

    Validates parameter values stored internally. Raise an exception if any parameter value is invalid.

    Definition Classes
    Params
  73. def validate(paramMap: ParamMap): Unit

    Validates parameter values stored internally plus the input parameter map.

    Validates parameter values stored internally plus the input parameter map. Raises an exception if any parameter is invalid.

    Definition Classes
    Params
  74. def validateAndTransformSchema(schema: StructType, paramMap: ParamMap, fitting: Boolean, featuresDataType: DataType): StructType

    Validates and transforms the input schema with the provided param map.

    Validates and transforms the input schema with the provided param map.

    schema

    input schema

    paramMap

    additional parameters

    fitting

    whether this is in fitting

    featuresDataType

    SQL DataType for FeaturesType. E.g., org.apache.spark.mllib.linalg.VectorUDT for vector features.

    returns

    output schema

    Attributes
    protected
    Definition Classes
    ProbabilisticClassifierParams → ClassifierParams → PredictorParams
  75. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  76. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  77. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from LogisticRegressionParams

Inherited from HasThreshold

Inherited from HasMaxIter

Inherited from HasRegParam

Inherited from ProbabilisticClassifier[Vector, LogisticRegression, LogisticRegressionModel]

Inherited from ProbabilisticClassifierParams

Inherited from HasProbabilityCol

Inherited from Classifier[Vector, LogisticRegression, LogisticRegressionModel]

Inherited from ClassifierParams

Inherited from HasRawPredictionCol

Inherited from Predictor[Vector, LogisticRegression, LogisticRegressionModel]

Inherited from PredictorParams

Inherited from HasPredictionCol

Inherited from HasFeaturesCol

Inherited from HasLabelCol

Inherited from Params

Inherited from Identifiable

Inherited from PipelineStage

Inherited from Logging

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Parameters

A list of (hyper-)parameter keys this algorithm can take. Users can set and get the parameter values through setters and getters, respectively.

Members

Parameter setters

Parameter getters