Class

org.apache.spark.ml.regression.odkl

LinearRegression

Related Doc: package odkl

Permalink

class LinearRegression extends Estimator[odkl.LinearRegressionModel] with SummarizableEstimator[odkl.LinearRegressionModel] with LinearRegressionParams with DefaultParamsWritable with HasWeights

Simple wrapper around the SparkML linear regression used to attach summary blocks. TODO: Add unit tests

Linear Supertypes
HasWeights, DefaultParamsWritable, MLWritable, LinearRegressionParams, HasLoss, HasAggregationDepth, HasSolver, HasWeightCol, HasStandardization, HasFitIntercept, HasTol, HasMaxIter, HasElasticNetParam, HasRegParam, PredictorParams, HasPredictionCol, HasFeaturesCol, HasLabelCol, SummarizableEstimator[odkl.LinearRegressionModel], Estimator[odkl.LinearRegressionModel], PipelineStage, Logging, Params, Serializable, Serializable, Identifiable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LinearRegression
  2. HasWeights
  3. DefaultParamsWritable
  4. MLWritable
  5. LinearRegressionParams
  6. HasLoss
  7. HasAggregationDepth
  8. HasSolver
  9. HasWeightCol
  10. HasStandardization
  11. HasFitIntercept
  12. HasTol
  13. HasMaxIter
  14. HasElasticNetParam
  15. HasRegParam
  16. PredictorParams
  17. HasPredictionCol
  18. HasFeaturesCol
  19. HasLabelCol
  20. SummarizableEstimator
  21. Estimator
  22. PipelineStage
  23. Logging
  24. Params
  25. Serializable
  26. Serializable
  27. Identifiable
  28. AnyRef
  29. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LinearRegression()

    Permalink
  2. new LinearRegression(uid: String)

    Permalink

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def $[T](param: Param[T]): T

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. final val aggregationDepth: IntParam

    Permalink
    Definition Classes
    HasAggregationDepth
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. final def clear(param: Param[_]): LinearRegression.this.type

    Permalink
    Definition Classes
    Params
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def copy(extra: ParamMap): SummarizableEstimator[odkl.LinearRegressionModel]

    Permalink
    Definition Classes
    LinearRegressionSummarizableEstimator → Estimator → PipelineStage → Params
  10. def copyValues[T <: Params](to: T, extra: ParamMap): T

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  11. final def defaultCopy[T <: Params](extra: ParamMap): T

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  12. final val elasticNetParam: DoubleParam

    Permalink
    Definition Classes
    HasElasticNetParam
  13. final val epsilon: DoubleParam

    Permalink
    Definition Classes
    LinearRegressionParams
    Annotations
    @Since( "2.3.0" )
  14. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def explainParam(param: Param[_]): String

    Permalink
    Definition Classes
    Params
  17. def explainParams(): String

    Permalink
    Definition Classes
    Params
  18. final def extractParamMap(): ParamMap

    Permalink
    Definition Classes
    Params
  19. final def extractParamMap(extra: ParamMap): ParamMap

    Permalink
    Definition Classes
    Params
  20. def extractWeights(model: LinearRegressionModel, sparkSession: SparkSession, attributes: AttributeGroup): DataFrame

    Permalink
  21. final val featuresCol: Param[String]

    Permalink
    Definition Classes
    HasFeaturesCol
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def fit(dataset: Dataset[_]): odkl.LinearRegressionModel

    Permalink
    Definition Classes
    LinearRegression → Estimator
  24. def fit(dataset: Dataset[_], paramMaps: Array[ParamMap]): Seq[odkl.LinearRegressionModel]

    Permalink
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  25. def fit(dataset: Dataset[_], paramMap: ParamMap): odkl.LinearRegressionModel

    Permalink
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  26. def fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): odkl.LinearRegressionModel

    Permalink
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" ) @varargs()
  27. final val fitIntercept: BooleanParam

    Permalink
    Definition Classes
    HasFitIntercept
  28. final def get[T](param: Param[T]): Option[T]

    Permalink
    Definition Classes
    Params
  29. final def getAggregationDepth: Int

    Permalink
    Definition Classes
    HasAggregationDepth
  30. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def getDefault[T](param: Param[T]): Option[T]

    Permalink
    Definition Classes
    Params
  32. final def getElasticNetParam: Double

    Permalink
    Definition Classes
    HasElasticNetParam
  33. def getEpsilon: Double

    Permalink
    Definition Classes
    LinearRegressionParams
    Annotations
    @Since( "2.3.0" )
  34. final def getFeaturesCol: String

    Permalink
    Definition Classes
    HasFeaturesCol
  35. final def getFitIntercept: Boolean

    Permalink
    Definition Classes
    HasFitIntercept
  36. final def getLabelCol: String

    Permalink
    Definition Classes
    HasLabelCol
  37. final def getLoss: String

    Permalink
    Definition Classes
    HasLoss
  38. final def getMaxIter: Int

    Permalink
    Definition Classes
    HasMaxIter
  39. final def getOrDefault[T](param: Param[T]): T

    Permalink
    Definition Classes
    Params
  40. def getParam(paramName: String): Param[Any]

    Permalink
    Definition Classes
    Params
  41. final def getPredictionCol: String

    Permalink
    Definition Classes
    HasPredictionCol
  42. final def getRegParam: Double

    Permalink
    Definition Classes
    HasRegParam
  43. final def getSolver: String

    Permalink
    Definition Classes
    HasSolver
  44. final def getStandardization: Boolean

    Permalink
    Definition Classes
    HasStandardization
  45. final def getTol: Double

    Permalink
    Definition Classes
    HasTol
  46. final def getWeightCol: String

    Permalink
    Definition Classes
    HasWeightCol
  47. final def hasDefault[T](param: Param[T]): Boolean

    Permalink
    Definition Classes
    Params
  48. def hasParam(paramName: String): Boolean

    Permalink
    Definition Classes
    Params
  49. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  50. val index: String

    Permalink
    Definition Classes
    HasWeights
  51. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  52. def initializeLogIfNecessary(isInterpreter: Boolean): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  53. final def isDefined(param: Param[_]): Boolean

    Permalink
    Definition Classes
    Params
  54. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  55. final def isSet(param: Param[_]): Boolean

    Permalink
    Definition Classes
    Params
  56. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  57. final val labelCol: Param[String]

    Permalink
    Definition Classes
    HasLabelCol
  58. def log: Logger

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

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

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

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

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

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

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  65. def logName: String

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

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

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

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

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  70. final val loss: Param[String]

    Permalink
    Definition Classes
    LinearRegressionParams → HasLoss
    Annotations
    @Since( "2.3.0" )
  71. final val maxIter: IntParam

    Permalink
    Definition Classes
    HasMaxIter
  72. val name: String

    Permalink
    Definition Classes
    HasWeights
  73. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  74. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  75. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  76. lazy val params: Array[Param[_]]

    Permalink
    Definition Classes
    Params
  77. final val predictionCol: Param[String]

    Permalink
    Definition Classes
    HasPredictionCol
  78. final val regParam: DoubleParam

    Permalink
    Definition Classes
    HasRegParam
  79. def save(path: String): Unit

    Permalink
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  80. final def set(paramPair: ParamPair[_]): LinearRegression.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  81. final def set(param: String, value: Any): LinearRegression.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  82. final def set[T](param: Param[T], value: T): LinearRegression.this.type

    Permalink
    Definition Classes
    Params
  83. def setAggregationDepth(value: Int): LinearRegression.this.type

    Permalink

    Suggested depth for treeAggregate (greater than or equal to 2).

    Suggested depth for treeAggregate (greater than or equal to 2). If the dimensions of features or the number of partitions are large, this param could be adjusted to a larger size. Default is 2.

    Annotations
    @Since( "2.1.0" )
  84. final def setDefault(paramPairs: ParamPair[_]*): LinearRegression.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  85. final def setDefault[T](param: Param[T], value: T): LinearRegression.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  86. def setElasticNetParam(value: Double): LinearRegression.this.type

    Permalink

    Set the ElasticNet mixing parameter.

    Set the ElasticNet mixing parameter. For alpha = 0, the penalty is an L2 penalty. For alpha = 1, it is an L1 penalty. For alpha in (0,1), the penalty is a combination of L1 and L2. Default is 0.0 which is an L2 penalty.

    Note: Fitting with huber loss only supports None and L2 regularization, so throws exception if this param is non-zero value.

    Annotations
    @Since( "1.4.0" )
  87. def setEpsilon(value: Double): LinearRegression.this.type

    Permalink

    Sets the value of param epsilon.

    Sets the value of param epsilon. Default is 1.35.

    Annotations
    @Since( "2.3.0" )
  88. def setFeaturesCol(value: String): LinearRegression.this.type

    Permalink

  89. def setFitIntercept(value: Boolean): LinearRegression.this.type

    Permalink

    Set if we should fit the intercept.

    Set if we should fit the intercept. Default is true.

    Annotations
    @Since( "1.5.0" )
  90. def setLabelCol(value: String): LinearRegression.this.type

    Permalink

  91. def setLoss(value: String): LinearRegression.this.type

    Permalink

    Sets the value of param loss.

    Sets the value of param loss. Default is "squaredError".

    Annotations
    @Since( "2.3.0" )
  92. def setMaxIter(value: Int): LinearRegression.this.type

    Permalink

    Set the maximum number of iterations.

    Set the maximum number of iterations. Default is 100.

    Annotations
    @Since( "1.3.0" )
  93. def setPredictionCol(value: String): LinearRegression.this.type

    Permalink

  94. def setRegParam(value: Double): LinearRegression.this.type

    Permalink

    Set the regularization parameter.

    Set the regularization parameter. Default is 0.0.

    Annotations
    @Since( "1.3.0" )
  95. def setSolver(value: String): LinearRegression.this.type

    Permalink

    Set the solver algorithm used for optimization.

    Set the solver algorithm used for optimization. In case of linear regression, this can be "l-bfgs", "normal" and "auto".

    • "l-bfgs" denotes Limited-memory BFGS which is a limited-memory quasi-Newton optimization method.
    • "normal" denotes using Normal Equation as an analytical solution to the linear regression problem. This solver is limited to LinearRegression.MAX_FEATURES_FOR_NORMAL_SOLVER.
    • "auto" (default) means that the solver algorithm is selected automatically. The Normal Equations solver will be used when possible, but this will automatically fall back to iterative optimization methods when needed.

    Note: Fitting with huber loss doesn't support normal solver, so throws exception if this param was set with "normal".

    Annotations
    @Since( "1.6.0" )
  96. def setStandardization(value: Boolean): LinearRegression.this.type

    Permalink

    Whether to standardize the training features before fitting the model.

    Whether to standardize the training features before fitting the model. The coefficients of models will be always returned on the original scale, so it will be transparent for users. Default is true.

    Annotations
    @Since( "1.5.0" )
    Note

    With/without standardization, the models should be always converged to the same solution when no regularization is applied. In R's GLMNET package, the default behavior is true as well.

  97. def setTol(value: Double): LinearRegression.this.type

    Permalink

    Set the convergence tolerance of iterations.

    Set the convergence tolerance of iterations. Smaller value will lead to higher accuracy with the cost of more iterations. Default is 1E-6.

    Annotations
    @Since( "1.4.0" )
  98. def setWeightCol(value: String): LinearRegression.this.type

    Permalink

    Whether to over-/under-sample training instances according to the given weights in weightCol.

    Whether to over-/under-sample training instances according to the given weights in weightCol. If not set or empty, all instances are treated equally (weight 1.0). Default is not set, so all instances have weight one.

    Annotations
    @Since( "1.6.0" )
  99. final val solver: Param[String]

    Permalink
    Definition Classes
    LinearRegressionParams → HasSolver
    Annotations
    @Since( "1.6.0" )
  100. final val standardization: BooleanParam

    Permalink
    Definition Classes
    HasStandardization
  101. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  102. def toString(): String

    Permalink
    Definition Classes
    Identifiable → AnyRef → Any
  103. final val tol: DoubleParam

    Permalink
    Definition Classes
    HasTol
  104. def transformSchema(schema: StructType): StructType

    Permalink
    Definition Classes
    LinearRegression → PipelineStage
  105. def transformSchema(schema: StructType, logging: Boolean): StructType

    Permalink
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  106. val uid: String

    Permalink
    Definition Classes
    LinearRegression → Identifiable
  107. def validateAndTransformSchema(schema: StructType, fitting: Boolean, featuresDataType: DataType): StructType

    Permalink
    Attributes
    protected
    Definition Classes
    LinearRegressionParams → PredictorParams
  108. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  111. val weight: String

    Permalink
    Definition Classes
    HasWeights
  112. final val weightCol: Param[String]

    Permalink
    Definition Classes
    HasWeightCol
  113. val weights: Block

    Permalink
    Definition Classes
    HasWeights
  114. def write: MLWriter

    Permalink
    Definition Classes
    DefaultParamsWritable → MLWritable

Inherited from HasWeights

Inherited from DefaultParamsWritable

Inherited from MLWritable

Inherited from LinearRegressionParams

Inherited from HasLoss

Inherited from HasAggregationDepth

Inherited from HasSolver

Inherited from HasWeightCol

Inherited from HasStandardization

Inherited from HasFitIntercept

Inherited from HasTol

Inherited from HasMaxIter

Inherited from HasElasticNetParam

Inherited from HasRegParam

Inherited from PredictorParams

Inherited from HasPredictionCol

Inherited from HasFeaturesCol

Inherited from HasLabelCol

Inherited from Estimator[odkl.LinearRegressionModel]

Inherited from PipelineStage

Inherited from Logging

Inherited from Params

Inherited from Serializable

Inherited from Serializable

Inherited from Identifiable

Inherited from AnyRef

Inherited from Any

expertSetParam

setExpertParam

setParam

Ungrouped