0
0
ML Pythonprogramming~20 mins

Types of ML (supervised, unsupervised, reinforcement) in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
ML Types Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Identify the type of learning from a description
You have a dataset with labeled images of cats and dogs. You want the model to learn to tell cats from dogs using these labels. What type of machine learning is this?
AUnsupervised learning
BSupervised learning
CReinforcement learning
DSelf-supervised learning
Attempts:
2 left
Predict Output
intermediate
2:00remaining
Output of clustering algorithm example
What is the output of this Python code using KMeans clustering on simple 2D points?
ML Python
from sklearn.cluster import KMeans
import numpy as np
points = np.array([[1,2],[1,4],[1,0],[10,2],[10,4],[10,0]])
kmeans = KMeans(n_clusters=2, random_state=0).fit(points)
labels = kmeans.labels_
print(labels.tolist())
A[0, 0, 0, 1, 1, 1]
B[1, 1, 1, 0, 0, 0]
C[0, 1, 0, 1, 0, 1]
D[1, 0, 1, 0, 1, 0]
Attempts:
2 left
Model Choice
advanced
1:30remaining
Choosing the right ML type for a game AI
You want to build an AI that learns to play a video game by trying moves and getting points as feedback. Which type of machine learning should you use?
ASupervised learning
BUnsupervised learning
CReinforcement learning
DSemi-supervised learning
Attempts:
2 left
Metrics
advanced
1:30remaining
Evaluating clustering quality
Which metric is commonly used to evaluate the quality of an unsupervised clustering model?
ACross-entropy loss
BAccuracy
CMean squared error
DSilhouette score
Attempts:
2 left
🔧 Debug
expert
2:30remaining
Why does this reinforcement learning code not update the policy?
Consider this simplified reinforcement learning code snippet. Why does the policy not improve after training?
ML Python
import numpy as np
policy = np.array([0.5, 0.5])
rewards = [1, -1, 1, -1]
actions = [0, 1, 0, 1]
for r, a in zip(rewards, actions):
    policy[a] += 0.1 * r
policy = policy / policy.sum()
print(policy)
APolicy probabilities can become negative causing invalid distribution
BNormalization divides by sum but sum can be zero causing error
CLearning rate 0.1 is too small to update policy noticeably
DRewards are not used to update the policy correctly
Attempts:
2 left