lassoBasic#

swordfish.function.lassoBasic()#

Perform lasso regression.

Parameters:
  • Y (Constant) – A numeric vector indicating the dependent variables.

  • X (Constant) –

    A numeric vector/tuple/matrix/table, indicating the independent variables.

    • When X is a vector/tuple, its length must be equal to the length of Y.

    • When X is a matrix/table, its number of rows must be equal to the length of Y.

  • mode (Constant) –

    An integer that can take the following three values:

    • 0 (default) : a vector of the coefficient estimates.

    • 1: a table with coefficient estimates, standard error, t-statistics, and p-values.

    • 2: a dictionary with the following keys: ANOVA, RegressionStat, Coefficient and Residual.

  • alpha (Constant) – A floating number representing the constant that multiplies the L1-norm. The default value is 1.0.

  • intercept (Constant) – A Boolean variable indicating whether the regression includes the intercept. If it is true, the system automatically adds a column of “1”s to X to generate the intercept. 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.

    Note

    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.