To encapsulate the Friedman-1 feature selection problem, we've created a Python class called Friedman1Test. This class can be found in the friedman.py file, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter07/friedman.py.
The main parts of this class are as follows:
- The __init__() method of the class creates the dataset, as follows:
self.X, self.y = datasets.make_friedman1(n_samples=self.numSamples, n_features=self.numFeatures, noise=self.NOISE, random_state=self.randomSeed)
- Then, it divides the data into two subsets –a training set and a validation set – using the scikit-learn model_selection.train_test_split() method:
self.X_train, self ...