Fitness and validation masks

EvoDAG.bagging_fitness

It splits the training data into the part used to evolve and the validation part, builds the masks used by the least-squares weights, and computes the fitness of an individual on each part.

mask_mul(a, mask)[source]

a * mask; the mask is an array or the scalar 1.0 (no validation set)

class BaggingFitness[source]

Computes the fitness on the training and validation sets of the nodes created by an EvoDAG object.

__init__(base=None)[source]
assert_fitness_function()[source]

Check that the fitness function of the base object is one of the supported ones.

property nclasses

Number of classes (3 for orthogonal or agreement selection in regression).

property score

Score object used to compute the classification measures, created on first use.

property min_class

Index of the least frequent class, computed on first use.

mask_fitness_BER(k)[source]

Return the training mask that keeps the same number of validation examples in each class.

mask_fitness_function(k)[source]

Return the training mask for the classes k, which depends on the fitness function.

set_classifier_mask(v, base_mask=True)[source]

Computes the mask used to create the training and validation set

transform_to_mo(v)[source]

Convert the labels v into a matrix with one column per class, with 1 for the class and -1 otherwise.

multiple_outputs_cl(v)[source]

Set the targets, masks and labels of the base object for a classification with multiple outputs.

set_regression_mask(v)[source]

Computes the mask used to create the training and validation set

test_regression_mask(v)[source]

Test whether the average prediction is different than zero

multiple_outputs_regression(v)[source]

Set the targets and masks of the base object for a regression with multiple outputs.

del_error(v)[source]

Remove the temporary validation error stored in the node v, if any.

fitness(v)[source]

Fitness function in the training set

fitness_vs(v)[source]

Fitness function in the validation set In classification it uses BER and RSE in regression

set_fitness(v)[source]

Set the fitness to a new node. Returns false in case fitness is not finite