Examples (KRR command)

KRR y WITH x1 TO x5
   /KERNEL RBF(ALPHA=.75).
  • The extension performs a kernel ridge regression of y on the covariate list x1 TO x5, which includes the variables x1, x5, and any variables in the active dataset between x1 and x5.
  • The RBF or radial basis function kernel type is used.
  • The regularization strength parameter ALPHA is set to .75, which results in less regularization than the default value of 1.
  • The GAMMA parameter is not specified, which means the sklearn default value of 1/p is passed to Python.
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.
KRR y WITH x
   /KERNEL RBF(ALPHA=.5 TO 1.5 BY .1 GAMMA=.01 .1 1)
   /KERNEL SIGMOID(ALPHA=.5 TO 1.5 BY .1 GAMMA=.01 .1 1 COEF0=0 1)
   /CROSSVALID NFOLDS=10
   /CRITERIA TIMER=15
   /PRINT COMPARE
   /SAVE PRED RESID.
  • Grid search using cross-validation is specified in order to select a best model.
  • For the RBF kernel, 30 models are generated, using ten different values for ALPHA and three different values for GAMMA.
  • For the SIGMOID kernel, 60 models are generated, using ten different values for ALPHA, three different values for GAMMA, and two different values for COEF0.
  • Each model is estimated ten times and the average cross-validation R2 is used to assess model accuracy.
  • The TIMER specification on the CRITERIA subcommand allows 15 minutes for execution.