Description Usage Arguments Value Examples
Run statistical model and get AUC results.
1 | get_p_result(data_list, model = c("svm", "randomforest"), func = NULL)
|
data_list |
data list including train_x, train_y and test_x |
model |
base classification model.
|
func |
If you set "model" to "self", you have to pass your self-defined model function. This function should be able to take "x_train" and "y_train" as the first two inputs to train the model and then take "x_test" as the third input and return the predicted scores of x_test data. For example, |
the scores predicted by models
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | library(mvtnorm)
library(MASS)
df = 10
rho = 0.5
d = 5
delta = rep(2, d)
H <- abs(outer(1:d, 1:d, "-"))
covxx = rho^H
n1_all <- n0_all <- 800
n1_p <- n0_p <- 15
x0_all = rmvt(n = n0_all, sigma = covxx, delta = rep(0, d), df = df)
x1_all = rmvt(n = n1_all, sigma = covxx, delta = delta, df = df)
x_data = rbind(x0_all, x1_all)
y_data = c(rep(0, n0_all), rep(1, n1_all))
id0 <- which(y_data == 0)
id1 <- which(y_data == 1)
id0_p <- sample(id0, n0_p)
id1_p <- sample(id1, n1_p)
id_p <- c(id0_p, id1_p)
x_pilot <- as.matrix(x_data[id_p, ])
y_pilot <- as.matrix(y_data[id_p])
n1_train <- n0_train <- n_train <- 60
n0_test <- n1_test <- 300
data_list = pilot_tfe_mvnorm_pca2(x_pilot, y_pilot, n0_train, n1_train, n0_test,
n1_test)
result = get_p_result(data_list, model = c("svm", "randomforest"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.