Where can I find a detailed explanation of how PolynomialFeatures are determined in the fitting process. What is actually taking place under the covers here, especially in poly_X = poly.fit_transform(X)
poly = PolynomialFeatures(degree=poly_degree)
poly_X = poly.fit_transform(X)
X_train, X_test, y_train, y_test = model_selection.train_test_split(poly_X, y, test_size=0.3, shuffle=True)
model = LinearRegression()
model.fit(X_train, y_train)
For example, if an input sample is two dimensional and of the form [a, b], the degree-2 polynomial features are [1, a, b, a^2, ab, b^2]
This is all it does. Altough the method name is calledfit_and_transform, it is not really a learning algorithm. It does not analyze our data to determine how to combine the features. It just produces all possible combinations as required by the setting of the degree value. So no matter what two dimensional data you pass to it, it always produces the stuff listed in the quote.