Predefined CNN¶
-
test_cnn.test_CNN_all_datasets(eval_func=None, batch_size=150, population=5, generations=10, iters=100, max_num_layers=10, max_num_neurons=20, evol_alg='mu_plus_lambda', sel='best', lrate=0.01, cxp=0, mtp=1, seed=None, sel_kwargs={}, max_filter=4, max_stride=3)¶ Tests the CNN network with all the possible datasets and with the specified parameter selection.
- Parameters
eval_func – Evaluation function for evaluating each network.
batch_size – Batch size of the data during the training of the networks.
population – Number of individuals in the populations in the genetic algorithm.
generations – Number of generations that will be done in the genetic algorithm.
iters – Number of iterations that each network will be trained.
max_num_layers – Maximum number of layers allowed in the networks.
max_num_neurons – Maximum number of neurons allowed in the networks.
max_filter – Maximum size of the filter allowed in the networks.
max_stride – Maximum size of the stride allowed in the networks.
evol_alg – Evolving algorithm that will be used during the genetic algorithm.
sel – Selection method that will be used during the genetic algorithm.
sel_kwargs – Arguments for selection method.
lrate – Learning rate that will be used during training.
cxp – Crossover probability that will be used during the genetic algorithm.
mtp – Mutation probability that will be used during the genetic algorithm.
seed – Seed that will be used in every random method.
-
test_cnn.test_CNN(dataset_name, eval_func=None, batch_size=150, population=5, generations=10, iters=100, max_num_layers=10, max_num_neurons=20, evol_alg='mu_plus_lambda', sel='best', lrate=0.01, cxp=0, mtp=1, seed=None, sel_kwargs={}, max_filter=4, max_stride=3)¶ Tests the CNN network with the specified dataset and parameter selection.
- Parameters
dataset_name – Name of the dataset that will be used in the genetic algorithm.
eval_func – Evaluation function for evaluating each network.
batch_size – Batch size of the data during the training of the networks.
population – Number of individuals in the populations in the genetic algorithm.
generations – Number of generations that will be done in the genetic algorithm.
iters – Number of iterations that each network will be trained.
max_num_layers – Maximum number of layers allowed in the networks.
max_num_neurons – Maximum number of neurons allowed in the networks.
max_filter – Maximum size of the filter allowed in the networks.
max_stride – Maximum size of the stride allowed in the networks.
evol_alg – Evolving algorithm that will be used during the genetic algorithm.
sel – Selection method that will be used during the genetic algorithm.
sel_kwargs – Arguments for selection method.
lrate – Learning rate that will be used during training.
cxp – Crossover probability that will be used during the genetic algorithm.
mtp – Mutation probability that will be used during the genetic algorithm.
seed – Seed that will be used in every random method.
- Returns
The last generation, a log book (stats) and the hall of fame (the best individuals found).
-
test_cnn.eval_cnn(nets, train_inputs, train_outputs, batch_size, iters, test_inputs, test_outputs, hypers)¶ Evaluation method for the CNN. Softmax cross entropy is used for the training and accuracy error for evaluating the network.
- Parameters
nets – Dictionary with the networks that will be used to build the final network and that represent the individuals to be evaluated in the genetic algorithm.
train_inputs – Input data for training, this data will only be used to give it to the created networks and train them.
train_outputs – Output data for training, it will be used to compare the returned values by the networks and see their performance.
batch_size – Number of samples per batch are used during training process.
iters – Number of iterations that each network will be trained.
test_inputs – Input data for testing, this data will only be used to give it to the created networks and test them. It can not be used during training in order to get a real feedback.
test_outputs – Output data for testing, it will be used to compare the returned values by the networks and see their real performance.
hypers – Hyperparameters that are being evolved and used in the process.
- Returns
Accuracy error obtained with the test data that evaluates the true performance of the network.