To encapsulate the hyperparameter tuning of the AdaBoost classifier for the wine dataset using a grid search – both the conventional version and the genetic algorithm-driven version – we created a Python class called HyperparameterTuningGrid. This class can be found in the 01-hyperparameter-tuning-grid.py file, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter08/01-hyperparameter-tuning-grid.py.
The main parts of this class are highlighted as follows:
- The __init__() method of the class initializes the wine dataset, the AdaBoost classifier, the k-fold cross-validation metric, and the grid parameters:
self.initWineDataset()
self.initClassifier()
self.initKfold()
self.initGridParams()
- The initGridParams() method initializes the grid search by setting...