Python problem representation

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:

  1. 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)
  1. 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 ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.