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
selectmodel(X, y,
            kernel = rbfkernel,
	    est_y = FALSE,
	    ydist = FALSE,
	    est_noise = FALSE,
	    regression = FALSE,
	    nmse = TRUE,
	    tcm = TRUE,
	    Xname = "X",
	    ...)

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 distimage)

est_noise

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

regression

only interesting if est_y or est_noise is TRUE. Set this to TRUE if you want to force the function to handle the data as data for a regression problem. If you leave this FALSE, the function will try to determine itself whether this is a classification or regression problem.

nmse

only interesting if est_noise is TRUE and the function is handling the data as data of a regression problem. If you leave this TRUE, the normalized mean squared error is used for estimating the noise level, otherwise the conventional mean squared error.

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 X by default and can be left as it is if you use rbfkernel or polykernel.

...

for each parameter of the kernel function you should give a list of parameters to select the best parameter combination from (e.g. for rbfkernel this is only the parameter sigma of for polykernel it's only the parameter d. See examples.)

Value

rd

estimated relevant dimension for best model

best

the best parameter combination which has been found through model selection

yh

only returned if est_y, alldim or est_noise is TRUE, contains the denoised labels for the best model

noise

only returned if est_noise is TRUE, contains the estimated noise level for the best model

Yd

contains the distances of the denoised labels and the original labels; needed for distimage

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