Error in running K nearest neighbours code in jupyter notebook

Hi, 



I come across this error message after running the codes provided in the ML primer under K nearest neghbours. How do i resolve it?

 

/tmp/ipykernel_60/2396175071.py:34: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
  plt.pcolormesh(xx, yy, Z, cmap=cmap_light)
/tmp/ipykernel_60/2396175071.py:34: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
  plt.pcolormesh(xx, yy, Z, cmap=cmap_light)

 

Hi Chueh,



Deprecation warnings are very common. They are warnings that notify us that a specific feature of the Python library (in this case matplotlib) might not work in future. These warnings are usually not considered to be critical and can be ignored by running the following line of code:

# To ignore warnings
import warnings
warnings.filterwarnings("ignore")

We've already made this update in the existing notebook - KNN Classification. Hence, you won't get this warning anymore.



Hope this was helpful.



Thanks,

Rushda Ansari