Visualizing decision boundaries
In this exercise, you'll visualize the decision boundaries of various classifier types.
A subset of scikit-learn
's built-in wine
dataset is already loaded into X
, along with binary labels in y
.
Diese Übung ist Teil des Kurses
Linear Classifiers in Python
Anleitung zur Übung
- Create the following classifier objects with default hyperparameters:
LogisticRegression
,LinearSVC
,SVC
,KNeighborsClassifier
. - Fit each of the classifiers on the provided data using a
for
loop. - Call the
plot_4_classifers()
function (similar to the code here), passing inX
,y
, and a list containing the four classifiers.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC, LinearSVC
from sklearn.neighbors import KNeighborsClassifier
# Define the classifiers
classifiers = [____]
# Fit the classifiers
for c in ____:
____
# Plot the classifiers
plot_4_classifiers(X, y, classifiers)
plt.show()