# NOT RUN {
library(Anthropometry)
library(doParallel)
# Prepare parallelization (including the seed for reproducibility):
no_cores <- detectCores() - 1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
clusterSetRNGStream(cl, iseed = 1)
# Load data:
data(mtcars)
data <- mtcars
n <- nrow(data)
# Arguments for the archetype/archetypoid algorithm:
# Number of archetypoids:
k <- 3
numRep <- 2
huge <- 200
# Size of the random sample of observations:
m <- 10
# Number of samples:
N <- floor(1 + (n - m)/(m - k))
N
prob <- 0.75
# ADALARA algorithm:
preproc <- preprocessing(data, stand = TRUE, percAccomm = 1)
data1 <- as.data.frame(preproc$data)
adalara_aux <- adalara(data1, N, m, k, numRep, huge, prob,
"ada_rob", FALSE, method = "adjbox", frame = FALSE)
#adalara_aux <- adalara(data1, N, m, k, numRep, huge, prob,
# "ada_rob", FALSE, vect_tol = c(0.95, 0.9, 0.85), alpha = 0.05,
# outl_degree = c("outl_strong", "outl_semi_strong", "outl_moderate"),
# method = "toler", frame = FALSE)
# Take the minimum RSS, which is in the second position of every sublist:
adalara <- adalara_aux[which.min(unlist(sapply(adalara_aux, function(x) x[2])))][[1]]
adalara
# End parallelization:
stopCluster(cl)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab