image_output_1.png
from mlxtend.plotting import plot_decision_regions

from sklearn.neighbors import KNeighborsClassifier

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

clf = KNeighborsClassifier()
clf.fit(X_train, y_train)
clf.score(X_test, y_test)

from mlxtend.plotting import plot_decision_regions

fig, ax = plt.subplots(figsize=(10, 8))
plot_decision_regions(X_test, y_test, clf=clf, legend=2);

clf = KNeighborsClassifier(2)
clf.fit(X_train, y_train)
clf.score(X_test, y_test)

fig, ax = plt.subplots(figsize=(10, 8))
plot_decision_regions(X_test, y_test, clf=clf, legend=2)