org.apache.spark.ml.regression

LinearRegression

class LinearRegression extends Regressor[Vector, LinearRegression, LinearRegressionModel] with LinearRegressionParams

:: AlphaComponent ::

Linear regression.

Annotations
@AlphaComponent()
Linear Supertypes
LinearRegressionParams, HasMaxIter, HasRegParam, Regressor[Vector, LinearRegression, LinearRegressionModel], RegressorParams, Predictor[Vector, LinearRegression, LinearRegressionModel], PredictorParams, HasPredictionCol, HasFeaturesCol, HasLabelCol, Estimator[LinearRegressionModel], Params, Identifiable, PipelineStage, Logging, Serializable, Serializable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By inheritance
Inherited
  1. LinearRegression
  2. LinearRegressionParams
  3. HasMaxIter
  4. HasRegParam
  5. Regressor
  6. RegressorParams
  7. Predictor
  8. PredictorParams
  9. HasPredictionCol
  10. HasFeaturesCol
  11. HasLabelCol
  12. Estimator
  13. Params
  14. Identifiable
  15. PipelineStage
  16. Logging
  17. Serializable
  18. Serializable
  19. AnyRef
  20. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LinearRegression()

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): LinearRegressionModel

    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[LinearRegressionModel]

    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[_]*): LinearRegressionModel

    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 getRegParam: Double

    Definition Classes
    HasRegParam
  27. def hashCode(): Int

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

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

    Checks whether a param is explicitly set.

    Checks whether a param is explicitly set.

    Definition Classes
    Params
  30. def isTraceEnabled(): Boolean

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

    param for label column name

    param for label column name

    Definition Classes
    HasLabelCol
  32. def log: Logger

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

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

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

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

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

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

    Attributes
    protected
    Definition Classes
    Logging
  39. def logName: String

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

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

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

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

    Attributes
    protected
    Definition Classes
    Logging
  44. val maxIter: IntParam

    param for max number of iterations

    param for max number of iterations

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

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

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

    Definition Classes
    AnyRef
  48. val paramMap: ParamMap

    Internal param map.

    Internal param map.

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

    Returns all params.

    Returns all params.

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

    param for prediction column name

    param for prediction column name

    Definition Classes
    HasPredictionCol
  51. val regParam: DoubleParam

    param for regularization parameter

    param for regularization parameter

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

    Sets a parameter in the embedded param map.

    Sets a parameter in the embedded param map.

    Attributes
    protected
    Definition Classes
    Params
  53. def setFeaturesCol(value: String): LinearRegression

    Definition Classes
    Predictor
  54. def setLabelCol(value: String): LinearRegression

    Definition Classes
    Predictor
  55. def setMaxIter(value: Int): LinearRegression.this.type

  56. def setPredictionCol(value: String): LinearRegression

    Definition Classes
    Predictor
  57. def setRegParam(value: Double): LinearRegression.this.type

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

    Definition Classes
    AnyRef
  59. def toString(): String

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

    :: 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
    LinearRegression → Predictor
  61. 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
  62. 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
  63. 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
  64. 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
  65. 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
    PredictorParams
  66. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from LinearRegressionParams

Inherited from HasMaxIter

Inherited from HasRegParam

Inherited from Regressor[Vector, LinearRegression, LinearRegressionModel]

Inherited from RegressorParams

Inherited from Predictor[Vector, LinearRegression, LinearRegressionModel]

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