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.
Cet exercice fait partie du cours
Linear Classifiers in Python
Instructions
- 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.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
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()