Tuning the hyperparameters using genetic algorithms

The genetic algorithm-based search for the best hyperparameter values is implemented by the Python program, 02-hyperparameter-tuning-genetic.py, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter08/02-hyperparameter-tuning-genetic.py.

The following steps describe the main parts of this program:

  1. We start by setting the lower and upper boundary for each of the float values representing a hyperparameter, as described in the previous subsection [1, 100] for n_estimators, [0.01, 1] for learning_rate, and [0, 1] for algorithm:
# [n_estimators, learning_rate, algorithm]:BOUNDS_LOW =  [  1, 0.01, 0]BOUNDS_HIGH = [100, 1.00, 1]

Get Hands-On Genetic Algorithms with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.