KRR

KRR is available in SPSS® Statistics Standard Edition or the Advanced Statistics Option.

KRR uses the Python sklearn.kernel_ridge.KernelRidge class to estimate a kernel ridge regression of a dependent variable on one or more independent variables. The independent variables include model hyperparameters, or a selection of hyperparameter values, over a specified grid of values. Cross validation is achieved by using the sklearn.model_selection.GridSearchCV class.

Note: The kernel regression algorithm requires working with an N x N matrix, where N is the number of cases. Memory requirements grow quickly with the number of cases, and the algorithm does not scale well to large datasets. Exact case limits depend on the operating system and specific hardware. Memory requirements might be exceeded when datasets contain 50,000 (or fewer) cases.
KRR dependent WITH covariate list
   [/KERNEL [ADDITIVE_CHI2(ALPHA={1}
                                 {[values] [value1 TO value2 BY value3]})] 
   [/KERNEL [CHI2(ALPHA={1}
                        {[values] [value1 TO value2 BY value3]})] 
                  GAMMA={1}
                        {[values] [value1 TO value2 BY value3]})]
   [/KERNEL COSINE(ALPHA={1}
                         {[values] [value1 TO value2 BY value3]})]
   [/KERNEL LAPLACIAN(ALPHA={1}
                            {[values] [value1 TO value2 BY value3]})]
                      GAMMA={1/p}
                            {[values] [value1 TO value2 BY value3]})]
   [/KERNEL LINEAR(ALPHA={1**}
                         {[values] [value1 TO value2 BY value3]})]
   [/KERNEL POLYNOMIAL(ALPHA={1}
                             {[values] [value1 TO value2 BY value3]})] 
                       GAMMA={1/p}
                             {[values] [value1 TO value2 BY value3]})]
                       COEF0={1}
                             {[values] [value1 TO value2 BY value3]})]
                       DEGREE={3} 
                              {[values] [value1 TO value2 BY value3]})]
   [/KERNEL RBF(ALPHA={1}
                      {[values] [value1 TO value2 BY value3]})]
                GAMMA={1/p}
                      {[values] [value1 TO value2 BY value3]})]
   [/KERNEL SIGMOID(ALPHA={1}
                          {[values] [value1 TO value2 BY value3]})]
                    GAMMA={1/p}
                          {[values] [value1 TO value2 BY value3]})]
                    COEF0={1}
                          {[values] [value1 TO value2 BY value3]})]
   [/CROSSVALID [NFOLDS={5**  }
                        {value}]
   [/CRITERIA TIMER={5**  }
                    {value}
   [/PRINT {BEST** }
           {COMPARE}
           {VERBOSE}]
   [/PLOT {OBSERVED} {RESIDUAL}]
   [/SAVE {PRED(varname)} {RESID(varname)} {DUAL(varname)}]

**Default if the subcommand or keyword is omitted.

/p is the number of predictor variable or covariates.

This command reads the active dataset and causes execution of any pending commands. See the topic Command Order for more information.

Syntax for the KRR command can be generated from the Kernel Ridge Regression dialog.

Example

KRR y WITH x
   /KERNEL POLYNOMIAL(DEGREE=2 COEF0=1)
   /PLOT RESIDUALS_VS_PREDICTED
   /SAVE PRED RESID DUAL.
  • The extension performs a kernel ridge regression of y on x.
  • A polynomial kernel is used.
  • The degree of the polynomial is 2, indicating a quadratic function.
  • The 0 coefficient for the polynomial kernel is set at its default value of 1.
  • The gamma value in the kernel is left at the default value of 1/p.
  • The alpha regularization parameter is left at the default value of 1.
  • A scatterplot of residuals versus predicted values is displayed.
  • Predicted values, residuals, and dual space coefficient weights are saved using default names.