January 2018
Beginner to intermediate
316 pages
7h 14m
English
A key method of working with numerical data and creating more features is through scikit-learn's PolynomialFeatures class. In its simplest form, this constructor will create new columns that are products of existing columns to capture feature interactions.
More specifically, this class will generate a new feature matrix with all of the polynomial combinations of the features with a degree less than or equal to the specified degree. Meaning that, if your input sample is two-dimensional, like so: [a, b], then the degree-2 polynomial features are as follows: [1, a, b, a^2, ab, b^2].
Read now
Unlock full access