Commit 6ff8aced authored by Edi Prifti's avatar Edi Prifti

- add warning option

- improve documentation
- improve digest plots => ggplot
- finishing the vignette
parent a6edb51f
This diff is collapsed.
......@@ -18,6 +18,7 @@
#' @param testAllSigns: ??
#' @param plot: plot graphics indicating the evolution of the simulation (default:FALSE)
#' @param verbose: print out information on the progress of the algorithm (default:TRUE)
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: print debug information (default:FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print a model and subsequently a population during the run (default:"short").
#' @param parallelize_folds: parallelize folds when cross-validating (default:TRUE)
......@@ -42,7 +43,8 @@ metal <- function(sparsity = 1:10, max.nb.features = 1000,
# evaluation options
objective = "auc", k_penalty = 0, evalToFit = "accuracy_", estimate_coefs = FALSE, intercept = "NULL", testAllSigns = FALSE,
# output options
plot = FALSE, verbose = TRUE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
plot = FALSE, verbose = TRUE, warnings = FALSE, debug = FALSE, print_ind_method = "short",
parallelize_folds = TRUE,
# computing options
nCores = 10, seed = "NULL", #maxTime = Inf,
# experiment options
......@@ -66,7 +68,8 @@ metal <- function(sparsity = 1:10, max.nb.features = 1000,
# print out intermediary results
clf$params$plot <- plot # plot results?
clf$params$verbose <- verbose # print out logs.
clf$params$debug <- debug # print out debugging information.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out debugging information.
clf$params$print_ind_method <- print_ind_method # method to print individual
# Computing options
......
......@@ -49,6 +49,7 @@
#' @param seed: the seed to be used for reproductibility. If seed=NULL than it is not taken into account (default:NULL).
#' @param nCores: the number of CPUs to run the programm in parallel
#' @param verbose: print out information on the progress of the algorithm (default:TRUE)
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: print out information on the progress of the algorithm (default:FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print a model and subsequently a population during the run (default:"short").
#' @param experiment.id: The id of the experiment that is to be used in the plots and comparitive analyses (default is the learner's name, when not specified)
......@@ -86,7 +87,8 @@ sota.rf <- function(sparsity = c(1:30), # when sparsityis null it means that we
popSaveFile = "NULL",
seed = "NULL",
nCores = 4,
verbose=TRUE,
verbose = TRUE,
warnings = FALSE,
debug = FALSE,
print_ind_method = "short",
experiment.id = NULL,
......@@ -120,7 +122,8 @@ sota.rf <- function(sparsity = c(1:30), # when sparsityis null it means that we
clf$params$do.trace <- do.trace # If set to TRUE, give a more verbose output as randomForest is run
clf$params$verbose <- verbose
clf$params$debug <- debug # print out logs.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out logs.
clf$params$print_ind_method <- print_ind_method # method to print individual
clf$params$evalToFit <- evalToFit
......
......@@ -49,6 +49,7 @@
#' @param seed: the seed to be used for reproductibility. If seed=NULL than it is not taken into account (default:NULL).
#' @param nCores: the number of CPUs to run the program in parallel
#' @param verbose: print out information on the progress of the algorithm (default:TRUE)
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: print out information on the progress of the algorithm (default:FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print a model and subsequently a population during the run (default:"short").
#' @param experiment.id: The id of the experiment that is to be used in the plots and comparitive analyses (default is the learner's name, when not specified)
......@@ -82,6 +83,7 @@ sota.svm <- function(sparsity = c(1:30), # when sparsity == 0 it means that we c
seed = "NULL",
nCores = 4,
verbose = TRUE,
warnings = FALSE,
debug = FALSE,
print_ind_method = "short",
experiment.id = NULL,
......@@ -127,8 +129,9 @@ sota.svm <- function(sparsity = c(1:30), # when sparsity == 0 it means that we c
clf$params$seed <- seed
clf$params$nCores <- nCores # parallel computing
clf$params$parallel <- nCores > 1 # parallel computing
clf$params$verbose <- verbose # print out logs.
clf$params$debug <- debug # print out logs.
clf$params$verbose <- verbose # print out logs.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out logs.
clf$params$print_ind_method <- print_ind_method # method to print individual
clf$params$evalToFit <- evalToFit
......
......@@ -40,6 +40,7 @@
#' @param testAllSigns: ??
#' @param plot: Plot different graphics (default:FALSE).
#' @param verbose: print out information on the progress of the algorithm (default:TRUE)
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: print debug information (default:FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print a model and subsequently a population during the run (default:"short").
#' @param nCores: the number of cores to execute the program. If nCores=1 than the program runs in a non parallel mode
......@@ -69,7 +70,7 @@ terBeam <- function(sparsity = 1:5, max.nb.features = 1000,
# evaluation options
objective = "auc", k_penalty=0, evalToFit = 'auc_', estimate_coefs=FALSE, intercept = "NULL", testAllSigns = FALSE,
# output options
plot = FALSE, verbose = TRUE, debug=FALSE, print_ind_method = "short", parallelize_folds = TRUE,
plot = FALSE, verbose = TRUE, warnings = FALSE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
# computing options
nCores = 4, seed = "NULL", #maxTime = Inf,
# experiment options
......@@ -79,7 +80,7 @@ terBeam <- function(sparsity = 1:5, max.nb.features = 1000,
clf <- list()
clf$learner <- "terBeam"
clf$params <- list()
clf$experiment <- list() # information about the experiment
clf$experiment <- list() # information about the experiment
clf$params$objective <- objective
clf$params$estimate_coefs <- estimate_coefs
clf$params$sparsity <- sparsity
......@@ -87,7 +88,7 @@ terBeam <- function(sparsity = 1:5, max.nb.features = 1000,
# clf$params$maxBeam <- maxBeam
# clf$params$FILENAME <- FILENAME
# clf$params$PREFIX <- PREFIX
clf$params$saveFiles <- saveFiles # It would be interesting to add this in the future
clf$params$saveFiles <- saveFiles # It would be interesting to add this in the future
# clf$params$pathSave <- pathSave
# clf$params$size_pop <- size_pop
......@@ -96,9 +97,10 @@ terBeam <- function(sparsity = 1:5, max.nb.features = 1000,
clf$params$nbVeryBest <- nbVeryBest
# print out intermediary results
clf$params$plot <- plot # print out logs.
clf$params$plot <- plot # print out logs.
clf$params$verbose <- verbose # print out logs.
clf$params$debug <- debug # print out debugging information.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out debugging information.
clf$params$print_ind_method <- print_ind_method # method to print individual
# Computing options
......
......@@ -43,6 +43,7 @@
#' @param final.pop.perc: ??
#' @param plot: Plot different graphics (default:FALSE).
#' @param verbose: print out information on the progress of the algorithm (default:TRUE)
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: print out debug infotmation when activated (default: FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print a model and subsequently a population during the run (default:"short").
#' @param parallelize_folds: parallelize folds when cross-validating (default:TRUE)
......@@ -67,7 +68,7 @@ terda <- function(sparsity = 5, nIterations = 5, max.nb.features = 1000, kBest =
# population options
popSaveFile = "NULL", final.pop.perc = 100, alpha = 0.5,
# output options
plot = FALSE, verbose = TRUE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
plot = FALSE, verbose = TRUE, warnings = FALSE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
# computing options
nCores = 4, seed = "NULL", #maxTime = Inf,
# experiment options
......@@ -77,7 +78,7 @@ terda <- function(sparsity = 5, nIterations = 5, max.nb.features = 1000, kBest =
clf <- list()
clf$learner <- "terda"
clf$params <- list()
clf$experiment <- list() # information about the experiment
clf$experiment <- list() # information about the experiment
clf$params$method <- method
clf$params$objective <- objective
clf$params$kStep <- kStep
......@@ -92,22 +93,23 @@ terda <- function(sparsity = 5, nIterations = 5, max.nb.features = 1000, kBest =
clf$params$nblambdas <- nblambdas
clf$params$vartype <- vartype
clf$params$alpha <- alpha # glmnet's elastcinet parameter
clf$params$alpha <- alpha # glmnet's elastcinet parameter
clf$params$nIterations <- nIterations
clf$params$max.nb.features <- max.nb.features
# print out intermediary results
clf$params$plot <- plot # save plots duting the process
clf$params$verbose <- verbose # print out logs.
clf$params$debug <- debug # print out logs.
clf$params$plot <- plot # save plots duting the process
clf$params$verbose <- verbose # print out logs.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out logs.
clf$params$print_ind_method <- print_ind_method # method to print individual
# Computing options
clf$params$nCores <- nCores # parallel computing
clf$params$parallel <- (nCores > 1) # parallel computing
clf$params$nCores <- nCores # parallel computing
clf$params$parallel <- (nCores > 1) # parallel computing
clf$params$parallelize_folds <- parallelize_folds
clf$params$parallel.local <- FALSE
clf$params$seed <- seed # fix the seed to be able to reproduce results
clf$params$seed <- seed # fix the seed to be able to reproduce results
clf$params$evalToFit <- evalToFit
clf$params$k_penalty <- k_penalty
......
......@@ -49,6 +49,7 @@
#' @param convergence_steps: the number of generations after which we consider convergence (default:10).
#' @param evolve_k1: weather or not to evaluate exhaustively the features for k_sparse=1. This will take a lot of time if the dataset is large, thus the possibility to evolve this using the GA. (default:TRUE)
#' @param verbose: print out information on the progress of the algorithm (default:TRUE)
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: print debug information (default:FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print a model and subsequently a population during the run (default:"short").
#' @param parallelize_folds: parallelize folds when cross-validating (default:TRUE)
......@@ -79,7 +80,7 @@ terga1 <- function(sparsity = c(1:10),
# evolution options
nb_generations = 100, convergence = TRUE, convergence_steps = 10, evolve_k1 = TRUE,
# output options
plot = FALSE, verbose = TRUE, debug=FALSE, print_ind_method = "short", parallelize_folds = TRUE,
plot = FALSE, verbose = TRUE, warnings = FALSE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
# computing options
nCores = 4, seed = "NULL",
# experiment options
......@@ -119,7 +120,8 @@ terga1 <- function(sparsity = c(1:10),
# print out intermediary results
clf$params$plot <- plot # plot results?
clf$params$verbose <- verbose # print out logs.
clf$params$debug <- debug # print out debugging information.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out debugging information.
clf$params$print_ind_method <- print_ind_method # method to print individual
# Computing options
......
......@@ -91,6 +91,7 @@
#' possibility to evolve this using the GA is interesting. (default:TRUE)
#' @param plot: Plot graphics indicating the evolution of the simulation (default:FALSE)
#' @param verbose: Print out information on the progress of the algorithm (default:FALSE).
#' @param warnings: Print out warnings when runnig (default:FALSE).
#' @param debug: Print out detailed information on the progress of the algorithm
#' (default:FALSE)
#' @param print_ind_method: One of c("short","graphical") indicates how to print
......@@ -132,7 +133,7 @@ terga2 <- function(sparsity = c(1:10), max.nb.features = 1000,
# evoluion options
evolver = "v2m", nb_generations = 100, convergence = TRUE, convergence_steps = 10, evolve_k1 = TRUE,
# output options
plot = FALSE, verbose = FALSE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
plot = FALSE, verbose = FALSE, warnings = FALSE, debug = FALSE, print_ind_method = "short", parallelize_folds = TRUE,
# computing options
nCores = 4, seed = "NULL", maxTime = Inf,
# experiment options
......@@ -215,6 +216,7 @@ terga2 <- function(sparsity = c(1:10), max.nb.features = 1000,
# print out intermediary results
clf$params$plot <- plot # plot results?
clf$params$verbose <- verbose # print out logs.
clf$params$warnings <- warnings # print out warnings
clf$params$debug <- debug # print out logs.
clf$params$print_ind_method <- print_ind_method # method to print individual
......@@ -282,7 +284,7 @@ terga2_fit <- function(X, y, clf)
if(clf$params$evalToFit == "auc_")
{
clf$params$evalToFit <- "accuracy_"
warning("terga1_fit: changing evalToFit from auc_ to accuracy_ because of the language.")
if(clf$params$warnings) warning("terga1_fit: changing evalToFit from auc_ to accuracy_ because of the language.")
}
}
},
......@@ -309,7 +311,7 @@ terga2_fit <- function(X, y, clf)
if(clf$params$evalToFit == "auc_")
{
clf$params$evalToFit <- "accuracy_"
warning("terga1_fit: changing evalToFit from auc_ to accuracy_ because of the language.")
if(clf$params$warnings) warning("terga1_fit: changing evalToFit from auc_ to accuracy_ because of the language.")
}
}
},
......
......@@ -213,7 +213,7 @@ individual_vec_v2 <- function(clf, signs = NULL)
{
if(clf$params$size_world == "NULL")
{
warning("individual_vec_v2: the size_world is not set while expected")
if(clf$params$warnings) warning("individual_vec_v2: the size_world is not set while expected")
return(NULL)
}
......@@ -323,7 +323,7 @@ tag_SelectRandom <- function(clf, pop, nbToSelect)
{
if(is.null(pop))
{
warning("resetTags: the population is empty")
if(clf$params$warnings) warning("resetTags: the population is empty")
return(NULL)
}
......@@ -378,7 +378,7 @@ tag_Couples <- function(pop, parents)
{
if(is.null(pop))
{
warning("resetTags: the population is empty")
if(clf$params$warnings) warning("resetTags: the population is empty")
return(NULL)
}
......@@ -411,7 +411,7 @@ tag_ToBeMutated <- function(pop, mutate_size, protected = NULL)
{
if(is.null(pop))
{
warning("resetTags: the population is empty")
if(clf$params$warnings) warning("resetTags: the population is empty")
return(NULL)
}
......@@ -431,7 +431,7 @@ tag_ToBeMutated <- function(pop, mutate_size, protected = NULL)
if(round(mutate_size) > possible.to.mutate)
{
warning(paste("tag_ToBeMutated: the protected individuals don't leave enough to mutate: nb protected",
if(clf$params$warnings) warning(paste("tag_ToBeMutated: the protected individuals don't leave enough to mutate: nb protected",
length(protected), " and nb available", possible.to.mutate,"mutating less ..."))
protected <- protected[1:(length(protected) - delta)] # stop protecting some to assure the mutation quota.
}
......@@ -525,7 +525,7 @@ resetTags <- function(pop, selected = FALSE, toBeMutated = FALSE, mate = -1)
if(is.null(pop))
{
warning("resetTags: the population is empty")
if(clf$params$warnings) warning("resetTags: the population is empty")
return(NULL)
}
......@@ -1033,7 +1033,7 @@ mutator_v2 <- function(X, y, clf, pop, individual_to_be_mutated, all_genes, feat
}
} else
{
warning("mutator_v2: Not enough features remaining for the insertion mutation. Nothing happened")
if(clf$params$warnings) warning("mutator_v2: Not enough features remaining for the insertion mutation. Nothing happened")
return(individual_to_be_mutated)
}
},
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment