0
0
Data Analysis Pythondata~10 mins

Polynomial features in Data Analysis 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.

Data Analysis Python
from sklearn.preprocessing import [1]
Drag options to blanks, or click blank then click option'
APolynomialFeatures
BStandardScaler
CMinMaxScaler
DOneHotEncoder
Attempts:
3 left
💡 Hint
Common Mistakes
Importing scalers instead of polynomial features.
Confusing one-hot encoding with polynomial features.
2fill in blank
medium

Complete the code to create polynomial features of degree 3.

Data Analysis Python
poly = PolynomialFeatures(degree=[1])
Drag options to blanks, or click blank then click option'
A2
B3
C1
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using degree 1 which does not add polynomial features.
Using degree 4 which is higher than requested.
3fill in blank
hard

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

Data Analysis Python
X_poly = poly.[1](X)
Drag options to blanks, or click blank then click option'
Afit
Btransform
Cfit_transform
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using only fit which does not transform data.
Using transform without fitting first.
Using predict which is not a method here.
4fill in blank
hard

Fill both blanks to create polynomial features without the bias term and degree 2.

Data Analysis Python
poly = PolynomialFeatures(degree=[1], include_bias=[2])
Drag options to blanks, or click blank then click option'
A2
BTrue
CFalse
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Including bias when not needed.
Using wrong degree value.
5fill in blank
hard

Fill all three blanks to create polynomial features of degree 2, exclude bias, and transform data X.

Data Analysis 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
Using degree 3 instead of 2.
Including bias when not needed.
Using only fit or transform instead of fit_transform.