0
0
ML Pythonprogramming~10 mins

Polynomial regression in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
ALinearRegression
BStandardScaler
Ctrain_test_split
DPolynomialFeatures
Attempts:
3 left
2fill in blank
medium

Complete 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'
A3
B1
C2
D4
Attempts:
3 left
3fill in blank
hard

Fix 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'
Atransform
Bfit_transform
Cfit
Dpredict
Attempts:
3 left
4fill in blank
hard

Fill 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'
Afit
Bpredict
Ctransform
Dscore
Attempts:
3 left
5fill in blank
hard

Fill 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'
A3
Bfit_transform
Cscore
Dtransform
Attempts:
3 left