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.
Deze oefening maakt deel uit van de cursus
Linear Classifiers in Python
Oefeninstructies
- Create the following classifier objects with default hyperparameters:
LogisticRegression,LinearSVC,SVC,KNeighborsClassifier. - Fit each of the classifiers on the provided data using a
forloop. - Call the
plot_4_classifers()function (similar to the code here), passing inX,y, and a list containing the four classifiers.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
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()