ridgeBasic#
- swordfish.function.ridgeBasic()#
Perform Ridge regression.
Minimize the following objective function:
\[\begin{align*} \lVert y - X w \rVert_2^2 + \alpha \, \lVert w \rVert_2^2 \end{align*}\]- Parameters:
Y (Constant) – A numeric vector indicating the dependent variable.
X (Constant) –
Aa numeric vector/tuple/matrix/table indicating the independent variable.
When X is a vector/tuple, it must be of the same length as Y.
When X is a matrix/table, the number of rows must be the same as the length of Y.
mode (Constant, optional) –
An integer indicating the contents in the output. It can be:
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, 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) – 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, 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.