Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the class used for polynomial features.
ML Python
from sklearn.preprocessing import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to create polynomial features of degree 3.
ML Python
poly = PolynomialFeatures(degree=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in transforming features to polynomial features.
ML Python
X_poly = poly.[1](X) Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to train a linear regression model on polynomial features.
ML Python
model = LinearRegression() model.[1](X_poly, y) predictions = model.[2](X_poly)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create polynomial features, train the model, and compute the R² score.
ML Python
poly = PolynomialFeatures(degree=[1]) X_poly = poly.[2](X) model = LinearRegression() model.fit(X_poly, y) score = model.[3](X_poly, y)
Drag options to blanks, or click blank then click option'
Attempts:
3 left