0
0
ML Pythonml~10 mins

Why engineered features improve models in ML Python - Test Your Understanding

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

Complete the code to create a new feature by combining two existing features.

ML Python
data['new_feature'] = data['feature1'] [1] data['feature2']
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or division which may not combine features meaningfully.
Forgetting to create a new feature column.
2fill in blank
medium

Complete the code to scale features before training the model.

ML Python
from sklearn.preprocessing import {{BLANK_1 }}
scaler = [1]()
data_scaled = scaler.fit_transform(data)
Drag options to blanks, or click blank then click option'
AOneHotEncoder
BMinMaxScaler
CStandardScaler
DLabelEncoder
Attempts:
3 left
💡 Hint
Common Mistakes
Using LabelEncoder which is for categorical labels.
Using OneHotEncoder which is for categorical variables.
3fill in blank
hard

Fix the error in the code to select only numeric features for feature engineering.

ML Python
numeric_features = data.select_dtypes(include=[1])
Drag options to blanks, or click blank then click option'
A'category'
B'number'
C'numeric'
D'object'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'object' or 'category' which select non-numeric columns.
Using 'numeric' which is not a valid dtype string.
4fill in blank
hard

Fill both blanks to create a dictionary of feature lengths for words longer than 3 characters.

ML Python
lengths = {word: [1] for word in words if len(word) [2] 3 }
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as the value instead of its length.
Using less than (<) instead of greater than (>) in the condition.
5fill in blank
hard

Fill all three blanks to filter features and create a dictionary of uppercase keys with values greater than zero.

ML Python
result = { [1]: [2] for k, v in data.items() if v [3] 0 }
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using k.lower() instead of k.upper().
Using less than (<) instead of greater than (>) in the condition.