0
0
ML Pythonml~10 mins

One-vs-rest and one-vs-one strategies in ML 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 create a one-vs-rest classifier using scikit-learn.

ML Python
from sklearn.multiclass import [1]
from sklearn.svm import SVC

model = [1](estimator=SVC())
Drag options to blanks, or click blank then click option'
AOneVsRestClassifier
BOneVsOneClassifier
CRandomForestClassifier
DKNeighborsClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Using OneVsOneClassifier instead of OneVsRestClassifier
Using a classifier that is not designed for multi-class wrapping
2fill in blank
medium

Complete the code to create a one-vs-one classifier using scikit-learn.

ML Python
from sklearn.multiclass import [1]
from sklearn.svm import SVC

model = [1](estimator=SVC())
Drag options to blanks, or click blank then click option'
AOneVsRestClassifier
BLogisticRegression
CDecisionTreeClassifier
DOneVsOneClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing OneVsRestClassifier with OneVsOneClassifier
Using a base estimator that is not compatible
3fill in blank
hard

Fix the error in the code to correctly train a one-vs-rest classifier.

ML Python
from sklearn.multiclass import OneVsRestClassifier
from sklearn.svm import SVC

model = OneVsRestClassifier(SVC())
model.[1](X_train, y_train)
Drag options to blanks, or click blank then click option'
Apredict
Bfit
Ctrain
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'train' instead of 'fit' to train the model
Using 'predict' or 'score' methods for training
4fill in blank
hard

Fill both blanks to create a one-vs-one classifier and train it.

ML Python
from sklearn.multiclass import [1]
from sklearn.svm import SVC

model = [2](estimator=SVC())
model.fit(X_train, y_train)
Drag options to blanks, or click blank then click option'
AOneVsOneClassifier
BOneVsRestClassifier
CRandomForestClassifier
DKNeighborsClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing OneVsRestClassifier and OneVsOneClassifier
Importing one class but instantiating another
5fill in blank
hard

Fill all three blanks to create a one-vs-rest classifier, train it, and predict on test data.

ML Python
from sklearn.multiclass import [1]
from sklearn.svm import SVC

model = [1](estimator=SVC())
model.[2](X_train, y_train)
predictions = model.[3](X_test)
Drag options to blanks, or click blank then click option'
AOneVsRestClassifier
Bfit
Cpredict
DOneVsOneClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Using OneVsOneClassifier instead of OneVsRestClassifier
Using 'train' instead of 'fit'
Using 'fit' instead of 'predict' for predictions