Complete the code to import the class for creating polynomial features.
from sklearn.preprocessing import [1]
The PolynomialFeatures class is used to generate polynomial and interaction features from the original features.
Complete the code to create polynomial features of degree 3.
poly = PolynomialFeatures(degree=[1])Setting degree=3 creates polynomial features up to cubic terms.
Fix the error in the code to transform the data using polynomial features.
X_poly = poly.[1](X)fit which does not transform data.transform without fitting first.predict which is not a method here.The fit_transform method fits the transformer and applies the transformation in one step.
Fill both blanks to create polynomial features without the bias term and degree 2.
poly = PolynomialFeatures(degree=[1], include_bias=[2])
Degree 2 creates quadratic features. Setting include_bias=False removes the constant term.
Fill all three blanks to create polynomial features of degree 2, exclude bias, and transform data X.
poly = PolynomialFeatures(degree=[1], include_bias=[2]) X_poly = poly.[3](X)
Degree 2 creates quadratic features, bias is excluded, and fit_transform applies the transformation.