0
0
ML Pythonprogramming~20 mins

Support Vector Machine (SVM) in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SVM Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main goal of a Support Vector Machine?
In simple terms, what does a Support Vector Machine try to do when it learns from data?
AIt tries to group data points into clusters without using labels.
BIt tries to find the line or boundary that best separates different groups with the widest gap.
CIt tries to reduce the number of features by combining them.
DIt tries to memorize all the training data points exactly to predict future data.
Attempts:
2 left
Predict Output
intermediate
2:00remaining
What is the output of this SVM prediction code?
Given this Python code using sklearn's SVM, what will be printed?
ML Python
from sklearn import svm
X = [[0, 0], [1, 1]]
y = [0, 1]
clf = svm.SVC(kernel='linear')
clf.fit(X, y)
pred = clf.predict([[2, 2]])
print(pred[0])
A1
B0
C[1]
DError: kernel not supported
Attempts:
2 left
Hyperparameter
advanced
2:00remaining
Which SVM hyperparameter controls the trade-off between margin size and classification error?
In SVM, which parameter lets you decide how much you want to avoid misclassifying training points versus having a wider margin?
AC
BGamma
CKernel
DDegree
Attempts:
2 left
Metrics
advanced
2:00remaining
Which metric is most suitable to evaluate an SVM classifier on imbalanced data?
If your SVM model predicts classes but one class is much rarer than the other, which metric gives a better sense of performance?
ARecall
BAccuracy
CF1 Score
DPrecision
Attempts:
2 left
🔧 Debug
expert
2:00remaining
What error does this SVM code raise?
Consider this code snippet. What error will it raise when run?
ML Python
from sklearn import svm
X = [[0, 0], [1, 1], [2, 2]]
y = [0, 1]
clf = svm.SVC(kernel='linear')
clf.fit(X, y)
AIndexError: list index out of range
BTypeError: kernel must be a string
CNo error, model fits successfully
DValueError: Found input variables with inconsistent numbers of samples
Attempts:
2 left