Parameters

EvoDAG is configured with the arguments of the scikit-learn classes (EvoDAGClassifier, EvoDAGRegressor, see Python), with keyword arguments to its native classes EvoDAGE, EvoDAG.model.EvoDAG and RGP.init (see Native API), and, as a JSON object, with EvoDAG-train --kw. This page starts with what the defaults are and where they come from, and then lists every parameter, what it does and the value it has in the default configuration. For the meaning of terms such as the validation split or the early stopping individual see How it works.

What are EvoDAG’s defaults?

The default configuration is what you get from EvoDAGClassifier() and EnsembleClassifier() (and, for regression, from EvoDAGRegressor() and EnsembleRegressor()), and from their native counterparts EvoDAGE(), EvoDAG.model.EvoDAG(), RGP.init() and EvoDAG-train -C, without saying anything else. For classification it is this:

Default
Function set Add 60 arguments, Mul 20, Min 5, Max 5, Hypot 2, NaiveBayes 5, NaiveBayesMN 5, Centroid 2, and the one-argument Fabs, Sqrt, Sin, Tan, Atan, Tanh
Population popsize 4000, population_class "SteadyState"
Stopping early_stopping_rounds 4000; time_limit 3600 seconds for one model, none for an ensemble
Validation split tr_fraction 0.5
Fitness fitness_function "macro-F1" (the macro-averaged F1 score)
Selection of the arguments at random, with no heuristic (see Selection; selection "random"): every argument of every function is an individual drawn uniformly at random from the population. The keys first_selection "random" and heuristic_functions "tailored" are in the file but only the heuristics ("agreement", "cosine", "pearson", "angle") read them
Selection of the individual that leaves random (negative_selection false)
Ensemble (EnsembleClassifier, EvoDAGE) n_estimators 30, seeds 0 to 29

Regression has its own file with a different function set (no NaiveBayes, NaiveBayesMN or Centroid), the fitness "ER", which has no effect there, and the ordinary selections: the file has no selection key, so the arguments are chosen by a tournament on fitness and the individual that leaves by a negative tournament (negative_selection true).

Where they come from

The default parameters, the number of arguments of each function included, were found by a random search over the parameter space on a benchmark of classification problems (several sentiment analysis problems and problems from the UCI repository), keeping the consensus of the parameters that obtained the best performance (see Citing). The selection of the arguments (random), the selection of the individual that leaves (random) and the fitness (macro-F1) are those of the configuration of the selection experiments with the lowest average rank when the 30 models of an EnsembleClassifier are combined; the Performance page calls this configuration rnd-rnd and compares it with the other 20.

The parameters of the scikit-learn classes

EvoDAGClassifier and EvoDAGRegressor have the arguments popsize, early_stopping_rounds, time_limit, random_state, params_fname and params. None in the first three means the value of the JSON file of the defaults (the classification or the regression one, according to the class), so the tables below apply as they are. random_state is the seed of the engine (an integer, 0 by default). params is a dictionary with any other parameter of this page, the function names included: it is where, for example, selection or fitness_function go. The ensembles (EnsembleClassifier, EnsembleRegressor) take the estimator, so its parameters are reached with the prefix estimator__, and they add n_estimators (30), n_jobs (1) and, for the classifier, voting.

Getting the classical selection

from EvoDAG import EvoDAGClassifier

# the classical selection: fitness tournaments for the parents and for the
# individual that leaves (the fit-fit of the Performance page)
classic = EvoDAGClassifier(params={"selection": "fitness",
                                   "negative_selection": True})

The native form is the same keywords given to EvoDAGE(...); on the command line, EvoDAG-train -C --kw '{"selection": "fitness", "negative_selection": true}'.

Two layers of defaults

There are two sets of default values and they differ.

  1. The configuration files EvoDAG/conf/default_parameters.json (classification) and EvoDAG/conf/default_parameters_r.json (regression), the ones described above. They are read by the scikit-learn classes, EvoDAGE, EvoDAG.model.EvoDAG, EvoDAG.EvoDAG.init (also RGP.init) and the command line.
  2. The keyword defaults of the constructor of the engine (EvoDAG.EvoDAG, also RGP and RootGP, in EvoDAG/base.py). They apply only when the class is called directly, as in RGP(...), without init.
Parameter Configuration file (classification) Constructor of the engine
popsize 4000 10000
early_stopping_rounds 4000 -1 (the population size)
function_set the 14 functions of the table above all the functions of EvoDAG.node
selection "random" None
negative_selection false true
unique_individuals false true
pr_variable 0.9 0.33
all_inputs true false
use_all_vars_input_functions true false
input_functions NaiveBayes, NaiveBayesMN, Centroid none
time_limit 3600 none

The two coincide in tournament_size, fs_tournament_size, tr_fraction, fitness_function, random_generations, first_selection, heuristic_functions, min_density, finite, seed and population_class. Use init unless you want the constructor’s own values.

A parameters file replaces the default file; it is not merged with it. A file written by EvoDAG-params contains the selection keys (selection, first_selection, heuristic_functions, negative_selection) and fitness_function; a model trained from a file that lacks the selection keys (-P, or params_fname) uses the constructor’s values for the selection (the tournaments on fitness) and the fitness the file has.

Where the values come from

When you create a model, its parameters are taken from three places, each one overriding the previous:

  1. the default configuration, a JSON file inside the package: default_parameters.json for classification and default_parameters_r.json for regression (classifier=False);
  2. a JSON file of your own, if you pass params_fname (or -P on the command line). It can be a single object, or a list of objects as the one written by EvoDAG-params, in which case the first one is used; it replaces the default file;
  3. the keyword arguments of the call (in the scikit-learn classes, the arguments popsize, early_stopping_rounds and time_limit, and the dictionary params).

Keep in mind two exceptions. EvoDAGE has its own time_limit argument, which is None (no limit) unless you set it, and which replaces the time_limit of the file; a single model uses the one in the file (and so does EvoDAGClassifier, unless you give its time_limit). And the function parameters (below) are not passed one by one to the engine: they are converted into its function set.

The values in the tables that follow are those of default_parameters.json, the classification configuration. Where default_parameters_r.json differs it is said.

The function set

There is one parameter for every function that EvoDAG can use to build an individual. They are written with the name of the function, capitalised. A boolean switches the function on or off; an integer gives the number of arguments that the function takes (a function that takes several arguments uses up to that many) and 0 switches it off.

Function Meaning Default
Add sum of its arguments, with least-squares coefficients 60 arguments
Mul product of its arguments 20
Min, Max element-wise minimum, maximum of the arguments 5 each
Hypot \(\sqrt{a^2 + b^2}\) of two arguments 2
Atan2, Div arctangent of the quotient, and quotient, of two arguments Atan2 0, Div false
NaiveBayes, NaiveBayesMN Gaussian and multinomial Naive Bayes over the arguments (classification only) 5 each
Centroid nearest centroid over the arguments (classification only) 2 (0 in regression)
Atan, Fabs, Sin, Sqrt, Tan, Tanh one-argument functions true
Acos, Acosh, Asin, Asinh, Atanh, Ceil, Cos, Cosh, Exp, Expm1, Floor, Lgamma, Log, Log10, Log1p, Log2, Sign, Sinh, Sq one-argument functions false
Argmax, Argmin present in the file with value 0, but not part of the engine’s function set, so a value has no effect 0

In regression NaiveBayes, NaiveBayesMN and Centroid are not used, and in the regression configuration they are 0.

Parameters of the evolution

Parameter Default What it does
popsize 4000 number of individuals in the population
population_class "SteadyState" "SteadyState" replaces one individual per step; "Generational" replaces the whole population every popsize offspring
early_stopping_rounds 4000 the run stops when this many offspring have been created without improving the early stopping individual; a negative value means popsize
generations null maximum number of generations (a generation is popsize offspring); null means no limit, and then the early stopping or the time limit ends the run
time_limit 3600 seconds. In an ensemble the limit is shared by all members: a member that finds less than two seconds left is not trained
seed 0 seed of the pseudo-random numbers; the members of an ensemble use seed, seed + 1, and so on
tournament_size 2 individuals drawn in each tournament, both when selecting arguments and when selecting the one that leaves
random_generations 0 number of generations in which arguments are drawn uniformly instead of by tournament on fitness. It has no effect with the default selection, which does not use a tournament on fitness for the arguments.
selection "random" (not set in regression) the scheme that chooses the arguments of an offspring: "fitness", "random", "agreement", "cosine", "pearson", "angle" or "novelty" (see Selection); None keeps the behaviour of orthogonal_selection and orthogonal_dot_selection, which selection overrides when it is given. The regression file does not have the key, and then the arguments are chosen by the tournament on fitness.
first_selection "random" (not set in regression) how the reference individual of the heuristics "agreement", "cosine", "pearson" and "angle" is chosen: "random" or "fitness"
heuristic_functions "tailored" (not set in regression) "tailored" applies the heuristic only to Add, NaiveBayes, NaiveBayesMN and Centroid; "all" to every function with more than one argument
negative_selection false (true in regression) when true the individual that an offspring replaces is the worst of a tournament of tournament_size; when false it is chosen at random
unique_individuals false when true an offspring that repeats a function applied to the same arguments is rejected
function_selection true when true the function of each offspring is chosen by a tournament on the average fitness its offspring obtained; when false, uniformly at random
fs_tournament_size 2 size of that tournament over functions
min_density 0.8 when the average fraction of non-zero values in the population is below it, only the functions that keep sparse data sparse are used

Parameters of the data and the fitness

Parameter Default What it does
classifier true classification when true, regression when false
fitness_function "macro-F1" ("ER" in regression, where it has no effect) measure of the fitness in classification; see below
multiple_outputs true whether the individuals have several outputs. It is always on in classification, where there is one output per class; in regression it is for problems with several targets, and the default configuration for regression turns it off
tr_fraction 0.5 proportion used for training when the data are split into the training and the validation part; see How it works. With 1 there is no validation set and generations must be set
finite true non-finite values (nan, infinities) in the input variables are replaced by zero

fitness_function accepts, for classification: macro-F1 (the default), BER (the mean recall over the classes), ER and accuracy, macro-Precision, F1 (of one class; the smallest one unless F1_index is given), macro-RecallF1, accDotMacroF1, and variants built from recall, precision and F1 whose names start with Dot or g_ (the geometric mean over the classes) or with a_ (the arithmetic mean). The definitions are in EvoDAG/bagging_fitness.py and EvoDAG/cython_utils.pyx. In regression the fitness is always minus the sum of absolute errors on the training part, and the validation fitness the negative relative squared error.

Parameters of the initial population

Parameter Default What it does
all_inputs true create individuals until every input variable has been used once, instead of until the population has popsize individuals
pr_variable 0.9 probability that an initial individual is a single input variable rather than an input function over several variables
input_functions ["NaiveBayes", "NaiveBayesMN", "Centroid"] (null in regression) functions used to build the initial individuals that combine inputs; names of functions among NaiveBayes, NaiveBayesMN, Centroid and MultipleVariables (all four at most)
use_all_vars_input_functions true first create one individual for each input function applied to all the variables
share_inputs false has no effect: the lists of inputs that it is meant to share are rebuilt right after

Other parameters of the engine

These are not in the default configuration files, but they are accepted by the constructors.

Parameter Default What it does
orthogonal_selection false the agreement heuristic with the first argument and the functions without the heuristic chosen by the tournament on fitness (see Selection); it is used only when selection is None
orthogonal_dot_selection false choose the arguments by a dot-product measure (see Selection)
F1_index -1 class used by fitness_function="F1"; -1 means the smallest class
remove_raw_inputs true free the training inputs once the initial population exists
number_tries_feasible_ind 30 attempts to find a valid individual before giving up
probability_calibration None a class with the fit / predict_proba interface of scikit-learn; it is fitted on the outputs of the early stopping individual on the validation part, and then enables predict_proba of a single model and the calibrated probabilities of the ensemble
labels None the class labels, if you do not want them taken from y
max_training_size not set with n_jobs greater than 1, each member of the ensemble learns from a random subsample of at most this many examples

EvoDAGE also takes n_estimators (30), n_jobs (1), tmpdir (a directory where finished members are stored, so that an interrupted fit can be resumed) and time_limit.

The random search of parameters

EvoDAG-params samples configurations from parameter_values.json. It is a JSON object that gives, for each parameter, the list of values that the search may choose from; one configuration takes one value of each list, and the configurations are drawn at random without repetition. The sets are:

Parameter Values that the search may choose
Add 2, 5, 10, 20, 40
Mul, Max, Min, NaiveBayes, Centroid 0, 2, 5, 10, 20, 40
NaiveBayesMN 2, 5, 10, 20, 40
Hypot, Atan2 0, 2
Acos, Asin, Atan, Cos, Div, Expm1, Fabs, Log1p, Sin, Sq, Sqrt, Tan true, false
every other function false
popsize 100, 200, 500, 1000, 2000, 4000 (only those that do not exceed the size of the training set)
early_stopping_rounds 500, 1000, 2000, 4000
population_class "SteadyState", "Generational"
unique_individuals, function_selection, all_inputs, use_all_vars_input_functions true, false
random_generations 0, 1
input_functions four lists: all three of NaiveBayes, NaiveBayesMN and MultipleVariables, and each of those alone
selection "random"
first_selection "random"
heuristic_functions "tailored"
negative_selection false
classifier, finite, fitness_function, fs_tournament_size, generations, min_density, multiple_outputs, pr_variable, share_inputs, time_limit, tournament_size, tr_fraction one fixed value

In a search for regression (EvoDAG-params -R) the four selection parameters (selection, first_selection, heuristic_functions and negative_selection) are left out, since random selection with random negative selection is the default of classification only, and the regression search keeps sampling with the constructor’s values for them. Combinations that make no sense are skipped: a Generational population needs early_stopping_rounds at least equal to popsize, and early_stopping_rounds cannot exceed the number of training examples. Each sampled configuration is trained three times, with seeds 0, 1 and 2, and the configurations are ranked by the median validation fitness of the three runs. See Command line for the options of EvoDAG-params, and use --parameters-values to search a space of your own.