I am trying to plot decision boundaries for KNN algorithm. I have datasets of following shapes:
x_train.shape: (2616, 66)
x_test.shape: (655, 66)
y_train.shape: (2616,)
y_test.shape: (655,)
No matter which features I choose to plot the chart always looks the same (except for values on x and y labels) i.e. it is only one coulor and no points are being plotted.
My code where I am plotting the data:
value=1
width=0.1
index1 = 0
index2 = 24
features_to_plot = np.array([index1, index2])
list_of_indices = []
for i in range(x_train.shape[1]):
if i == index1 or i == index2:
pass
else:
list_of_indices.append(i)
fillers_values = {k: value for k in list_of_indices}
fillers_widths = {k: width for k in list_of_indices}
plot_decision_regions(X=x_train, y=y_train.astype(np.int_),\
clf=KNN, legend=2,\
feature_index=features_to_plot,\
filler_feature_values=fillers_values,\
filler_feature_ranges=fillers_widths)
plt.title(f'KNN decision boundary')
plt.show()
How can I fix this?