lasso#
- swordfish.function.lasso()#
Estimate a Lasso regression that performs L1 regularization.
- Parameters:
ds (Constant) – An in-memory table or a data source usually generated by the sqlDS function.
yColName (Constant) – A string indicating the column name of the dependent variable in ds.
xColNames (Constant) – A string scalar/vector indicating the column names of the independent variables in ds.
alpha (Constant) – A floating number representing the constant that multiplies the L1-norm. The default value is 1.0.
intercept (Constant) – A Boolean value indicating whether to include the intercept in the regression. The default value is true.
normalize (Constant) – A Boolean value. If true, the regressors will be normalized before regression by subtracting the mean and dividing by the L2-norm. If intercept =false, this parameter will be ignored. The default value is false.
maxIter (Constant) – A positive integer indicating the maximum number of iterations. The default value is 1000.
tolerance (Constant) – A floating number. The iterations stop when the improvement in the objective function value is smaller than tolerance. The default value is 0.0001.
positive (Constant) – A Boolean value indicating whether to force the coefficient estimates to be positive. The default value is false.
swColName (Constant) – A STRING indicating a column name of ds. The specified column is used as the sample weight. If it is not specified, the sample weight is treated as 1.
checkInput (Constant) –
A BOOLEAN value. It determines whether to enable validation check for parameters yColName, xColNames, and swColName.
If checkInput = true (default), it will check the invalid value for parameters and throw an error if the null value exists.
If checkInput = false, the invalid value is not checked.
It is recommended to specify checkInput = true. If it is false, it must be ensured that there are no invalid values in the input parameters and no invalid values are generated during intermediate calculations, otherwise the returned model may be inaccurate.