#===================================================
# Loading the library and its dependencies
#===================================================
library("MVR")
## Not run:
# #===================================================
# # MVR package news
# #===================================================
# MVR.news()
#
# #================================================
# # MVR package citation
# #================================================
# citation("MVR")
#
# #===================================================
# # Loading of the Synthetic and Real datasets
# # (see description of datasets)
# #===================================================
# data("Synthetic", "Real", package="MVR")
# ?Synthetic
# ?Real
# ## End(Not run)
#===================================================
# Mean-Variance Regularization (Synthetic dataset)
# Single-Group Assumption
# Assuming equal variance between groups
# Without cluster usage
#===================================================
nc.min <- 1
nc.max <- 10
probs <- seq(0, 1, 0.01)
n <- 10
mvr.obj <- mvr(data = Synthetic,
block = rep(1,n),
tolog = FALSE,
nc.min = nc.min,
nc.max = nc.max,
probs = probs,
B = 100,
parallel = FALSE,
conf = NULL,
verbose = TRUE)
## Not run:
# #===================================================
# # Examples of parallelization below with
# # a SOCKET or MPI cluster configuration
# #===================================================
# # 1- WINDOWS multicores PC with SOCKET communication
# # With a 2-Quad (8-CPUs) PC
# #===================================================
# if (.Platform$OS.type == "windows") {
# cpus <- detectCores()
# conf <- list("names" = rep("localhost", cpus),
# "cpus" = cpus,
# "type" = "SOCK",
# "homo" = TRUE,
# "verbose" = TRUE,
# "outfile" = "")
# }
# #===================================================
# # 2- LINUX multinodes cluster with SOCKET communication
# # with 4-nodes (32-CPUs) cluster
# # with 1 masternode and 3 workernodes
# # All hosts run identical setups
# # Same number of core CPUs (8) per node
# #===================================================
# if (.Platform$OS.type == "unix") {
# masterhost <- Sys.getenv("HOSTNAME")
# slavehosts <- c("compute-0-0", "compute-0-1", "compute-0-2")
# nodes <- length(slavehosts) + 1
# cpus <- 8
# conf <- list("names" = c(rep(masterhost, cpus),
# rep(slavehosts, cpus)),
# "cpus" = nodes * cpus,
# "type" = "SOCK",
# "homo" = TRUE,
# "verbose" = TRUE,
# "outfile" = "")
# }
# #===================================================
# # 3- LINUX multinodes cluster with MPI communication
# # Here, a file named ".nodes" (e.g. in the home directory)
# # must contain the list of nodes of the cluster
# #===================================================
# if (.Platform$OS.type == "unix") {
# hosts <- scan(file=paste(Sys.getenv("HOME"), "/.nodes", sep=""),
# what="",
# sep="\n")
# hostnames <- unique(hosts)
# nodes <- length(hostnames)
# cpus <- length(hosts)/length(hostnames)
# conf <- list("cpus" = nodes * cpus,
# "type" = "MPI",
# "homo" = TRUE,
# "verbose" = TRUE,
# "outfile" = "")
# }
# #===================================================
# # Run:
# # Mean-Variance Regularization (Real dataset)
# # Multi-Group Assumption
# # Assuming unequal variance between groups
# #===================================================
# nc.min <- 1
# nc.max <- 30
# probs <- seq(0, 1, 0.01)
# n <- 6
# GF <- factor(gl(n = 2, k = n/2, len = n),
# ordered = FALSE,
# labels = c("M", "S"))
# mvr.obj <- mvr(data = Real,
# block = GF,
# tolog = FALSE,
# nc.min = nc.min,
# nc.max = nc.max,
# probs = probs,
# B = 100,
# parallel = TRUE,
# conf = conf,
# verbose = TRUE)
# ## End(Not run)
Run the code above in your browser using DataLab