0
0
ML Pythonml~10 mins

Why advanced techniques handle complex data 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 import the machine learning library.

ML Python
import [1]
Drag options to blanks, or click blank then click option'
Asklearn
Btensorflow
Cnumpy
Dmatplotlib
Attempts:
3 left
💡 Hint
Common Mistakes
Importing numpy instead of sklearn
Importing matplotlib which is for plotting
Importing tensorflow which is for deep learning but not the simplest here
2fill in blank
medium

Complete the code to create a decision tree classifier.

ML Python
from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier([1]=42)
Drag options to blanks, or click blank then click option'
Alearning_rate
Bmax_depth
Cn_estimators
Drandom_state
Attempts:
3 left
💡 Hint
Common Mistakes
Using max_depth which limits tree size but is not for randomness
Using n_estimators which is for ensemble methods
Using learning_rate which is for boosting methods
3fill in blank
hard

Fix the error in the code to train the model on data X and labels y.

ML Python
model.fit([1], y)
Drag options to blanks, or click blank then click option'
AX
Bfit
Cy
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping X and y arguments
Passing the model itself as data
Passing the method name instead of data
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 letters.

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 value instead of its length
Using less than instead of greater than in condition
5fill in blank
hard

Fill all three blanks to create a filtered dictionary with uppercase keys and values greater than 2.

ML Python
filtered = [1]: [2] for [3], [2] in data.items() if [2] > 2
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
Ck
Ditems
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'items' as loop variable instead of key
Not converting keys to uppercase
Using wrong variable names