Class: LinearRegression

eclairjs/ml/regression.LinearRegression

Linear regression. The learning objective is to minimize the squared error, with regularization. The specific squared error loss function used is: L = 1/2n ||A coefficients - y||^2^ This support multiple types of regularization: - none (a.k.a. ordinary least squares) - L2 (ridge regression) - L1 (Lasso) - L2 + L1 (elastic net)

Constructor

new LinearRegression(uidopt)

Parameters:
Name Type Attributes Description
uid string <optional>
Source:

Extends

Methods

(static) load(path) → {module:eclairjs/ml/regression.LinearRegression}

Parameters:
Name Type Description
path string
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

copy(extra) → {module:eclairjs/ml/regression.LinearRegression}

Parameters:
Name Type Description
extra module:eclairjs/ml/param.ParamMap
Overrides:
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

elasticNetParam() → {module:eclairjs/ml/param.DoubleParam}

Param for the ElasticNet mixing parameter, in range [0, 1]. For alpha = 0, the penalty is an L2 penalty. For alpha = 1, it is an L1 penalty.
Source:
Returns:
Type
module:eclairjs/ml/param.DoubleParam

extractParamMap() → {module:eclairjs/ml/param.ParamMap}

Inherited From:
Source:
Returns:
Type
module:eclairjs/ml/param.ParamMap

fit(dataset) → {module:eclairjs/ml/regression.LinearRegressionModel}

Parameters:
Name Type Description
dataset module:eclairjs/sql.DataFrame
Overrides:
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegressionModel

fitIntercept() → {module:eclairjs/ml/param.BooleanParam}

Param for whether to fit an intercept term.
Source:
Returns:
Type
module:eclairjs/ml/param.BooleanParam

regParam() → {module:eclairjs/ml/param.DoubleParam}

Param for regularization parameter (>= 0).
Source:
Returns:
Type
module:eclairjs/ml/param.DoubleParam

setElasticNetParam(value) → {module:eclairjs/ml/regression.LinearRegression}

Set the ElasticNet mixing parameter. For alpha = 0, the penalty is an L2 penalty. For alpha = 1, it is an L1 penalty. For 0 < alpha < 1, the penalty is a combination of L1 and L2. Default is 0.0 which is an L2 penalty.
Parameters:
Name Type Description
value number
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setFeaturesCol(value) → {module:eclairjs/ml.Predictor}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml.Predictor

setFitIntercept(value) → {module:eclairjs/ml/regression.LinearRegression}

Set if we should fit the intercept Default is true.
Parameters:
Name Type Description
value boolean
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setLabelCol(value) → {module:eclairjs/ml.Predictor}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml.Predictor

setMaxIter(value) → {module:eclairjs/ml/regression.LinearRegression}

Set the maximum number of iterations. Default is 100.
Parameters:
Name Type Description
value number
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setPredictionCol(value) → {module:eclairjs/ml.Predictor}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml.Predictor

setRegParam(value) → {module:eclairjs/ml/regression.LinearRegression}

Set the regularization parameter. Default is 0.0.
Parameters:
Name Type Description
value number
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setSolver(value) → {module:eclairjs/ml/regression.LinearRegression}

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. The default value is "auto" which means that the solver algorithm is selected automatically.
Parameters:
Name Type Description
value string
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setStandardization(value) → {module:eclairjs/ml/regression.LinearRegression}

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. Note that 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. Default is true.
Parameters:
Name Type Description
value boolean
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setTol(value) → {module:eclairjs/ml/regression.LinearRegression}

Set the convergence tolerance of iterations. Smaller value will lead to higher accuracy with the cost of more iterations. Default is 1E-6.
Parameters:
Name Type Description
value number
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

setWeightCol(value) → {module:eclairjs/ml/regression.LinearRegression}

Whether to over-/under-sample training instances according to the given weights in weightCol. If empty, all instances are treated equally (weight 1.0). Default is empty, so all instances have weight one.
Parameters:
Name Type Description
value string
Source:
Returns:
Type
module:eclairjs/ml/regression.LinearRegression

transformSchema(schema) → {module:eclairjs/sql/types.StructType}

Parameters:
Name Type Description
schema module:eclairjs/sql/types.StructType
Inherited From:
Source:
Returns:
Type
module:eclairjs/sql/types.StructType