0
0
ML Pythonml~10 mins

Polynomial features 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 for creating polynomial features.

ML Python
from sklearn.preprocessing import [1]
Drag options to blanks, or click blank then click option'
AStandardScaler
BMinMaxScaler
CLinearRegression
DPolynomialFeatures
Attempts:
3 left
💡 Hint
Common Mistakes
Importing a scaler class instead of PolynomialFeatures.
Confusing PolynomialFeatures with regression models.
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
💡 Hint
Common Mistakes
Using degree 1 which does not add polynomial features.
Choosing degree 2 when cubic features are needed.
3fill in blank
hard

Fix the error in the code to transform features using polynomial features.

ML Python
X_poly = poly.[1](X)
Drag options to blanks, or click blank then click option'
Apredict
Btransform
Cfit_transform
Dfit
Attempts:
3 left
💡 Hint
Common Mistakes
Using only fit which does not transform data.
Using transform without fitting first.
4fill in blank
hard

Fill both blanks to create polynomial features and exclude the bias term.

ML Python
poly = PolynomialFeatures(degree=[1], include_bias=[2])
Drag options to blanks, or click blank then click option'
A3
BTrue
CFalse
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to exclude the bias term when not needed.
Using the wrong degree for the polynomial features.
5fill in blank
hard

Fill all three blanks to create polynomial features, transform data, and print the shape of the result.

ML Python
poly = PolynomialFeatures(degree=[1], include_bias=[2])
X_poly = poly.[3](X)
Drag options to blanks, or click blank then click option'
A2
BFalse
Cfit_transform
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Including bias when not needed.
Using transform without fitting first.