Description Usage Arguments Details Author(s) References See Also Examples
This generic function tunes hyperparameters of statistical methods using a grid search over supplied parameter ranges for ksmm.
1 | kfold_ksmm(x, y, x_dim, cost_range, sigma_range, kernel, nFold = 5, nCores = 1, ...)
|
x |
a input data matrix |
y |
a response vector with one label for each row/component of X. It must be 1 or -1 |
x_dim |
the size of input matrix X |
cost_range |
input data matrix to test |
sigma_range |
input data matrix to test |
kernel |
the kernel used in training and predicting |
nFold |
the number of partitions for cross-valication |
nCores |
the number of cores to use for parallel computing |
This function is used to tune the parameters of ksmm. Detailed theory is included in the KSMM paper.
Kyuri Park
Ye, Y. (2019). A nonlinear kernel support matrix machine. International Journal of Machine Learning and Cybernetics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | require(ksmm)
data(nottingham)
X = as.matrix(nottingham[,-1])
y = ifelse(nottingham[,1] == 1, 1, -1)
cost_seq = 2^{-1:1}
sigma_seq = 10^{-1:1}
train_x = X[c(1,2,99,100),]
train_y = y[c(1,2,99,100)]
kfold_fit = kfold_ksmm(x= train_x, y = train_y, x_dim = c(200, 200), cost_range = cost_seq,
sigma_range = sigma_seq, kernel='rbf', nCores = 1, maxit = 1e+3, epsilon = 5e-2, nFold = 1)
opt_cost = kfold_fit$opt_params[1]
opt_sigma = kfold_fit$opt_params[2]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.