ridge#

swordfish.function.ridge()#

Linear least squares with l2 regularization.

Minimize the following objective function:

\[\begin{align*} &\|y - X w\|_2^2 + \alpha \,\|w\|_2^2 \end{align*}\]
Parameters:
  • ds (Constant) – Aan in-memory table, or a data source, or a list of data sources.

  • 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, optional) – A floating number representing the constant that multiplies the L1-norm. The default value is 1.0.

  • intercept (Constant, optional) – A Boolean value indicating whether to include the intercept in the regression. The default value is true.

  • normalize (Constant, optional) – ABoolean 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, optional) – A positive integer indicating the maximum number of iterations. The default value is 1000.

  • tolerance (Constant, optional) – A floating number. The iterations stop when the improvement in the objective function value is smaller than tolerance. The default value is 0.0001.

  • solver (Constant, optional) – A string indicating the solver to use in the computation. It can be either ‘svd’ or ‘cholesky’. It ds is a list of data sources, solver must be ‘cholesky’.

  • swColName (Constant, optional) – 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.