# Model selection

### Description

The function can be used for selecting the kernel from a number of possible candidates which fits the problem best. You need a parametrized kernel function and a number of possible parameters. A relevant dimension estimation will be done for all parameter combinations and the one with the smallest loo-cv-error/negative-log-likelihood on its estimated relevant dimension will be chosen.

### Usage

1 2 3 4 5 6 7 8 9 10 |

### Arguments

`X` |
matrix containing a data point in each row |

`y` |
label vector which contains the label for each data point |

`kernel` |
parametrized kernel function which should be used |

`est_y` |
set this to TRUE if you want a denoised version of the labels for the best model |

`ydist` |
set this to TRUE if you want a matrix, which contains the distances between the denoised
labels and the original labels for all dimensions and all parameter combinations (each line
in the matrix contains the distances for one parameter combination. This is needed for |

`est_noise` |
set this to TRUE if you want an estimated noise level (for the best model) |

`regression` |
only interesting if |

`nmse` |
only interesting if |

`tcm` |
this is TRUE by default; indicates whether rde should be done by TCM or LOO-CV algorithm |

`Xname` |
the name of the parameter of the kernel function which should contain the data points. This is |

`...` |
for each parameter of the kernel function you should give a list of parameters to select the best
parameter combination from (e.g. for |

### Value

`rd` |
estimated relevant dimension for best model |

`best` |
the best parameter combination which has been found through model selection |

`yh` |
only returned if |

`noise` |
only returned if |

`Yd` |
contains the distances of the denoised labels and the original labels; needed for |

`rds` |
estimated relevant dimensions for each model |

`err` |
loo-cv-error/negative-log-likelihood-value for each dimension for the best model |

`errs` |
loo-cv-error/negative-log-likelihood-value for each dimension for all models (in each line is the error for one model) |

`kpc` |
kernel pca coefficients for best model |

`eigvec` |
eigenvectors of the kernel matrix for best model |

`eigval` |
eigenvalues of the kernel matrix for best model |

`params` |
list of parameters for the kernel function which has been given to the function |

`tcm` |
TRUE if TCM algorithm was used, otherwise (LOO-CV algorithm) FALSE |

`kernel` |
kernel function which has been used |

`Xname` |
the name of the parameter of the kernel function which should contain the data points as it has been given to the function |

`X` |
matrix with the data points as it has been given to the function |

`regression` |
TRUE, if the data are data of a regression problem, FALSE in case of a classification problem |

### Author(s)

Jan Saputra Mueller

### References

M. L. Braun, J. M. Buhmann, K. R. Mueller (2008) \_On Relevant Dimensions in Kernel Feature Spaces\_

### See Also

`rde`

, `modelimage`

, `distimage`

, `drawkpc`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
## model selection with RBF-kernel
d <- sincdata(100, 0.1) # generate sinc data
# do model selection, calculate also denoised labels
m <- selectmodel(d$X, d$y, est_y = TRUE, sigma = logspace(-3, 3, 100))
m$best # best model
m$rd # relevant dimension for best model
modelimage(m) # draw model selection image
## model selection with polynomial kernel
d <- sincdata(100, 0.1) # generate sinc data
# do model selection, calculate also denoised labels
m <- selectmodel(d$X, d$y, kernel = polykernel, est_y = TRUE, d = 1:20)
m$best # best model
m$rd # relevant dimension for best model
modelimage(m, log = FALSE) # draw model selection image
``` |