Python Forum

Full Version: Python for machine learning, complete beginners
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am following along in this youtube video here: https://www.youtube.com/watch?v=80fZrVMurPM&t=3797s

I do fine with minor hiccups until the 1:03 mark, where the classifier (KNN) is being fit to the training data. It says missing one required positional argument (y), when I clearly have it there. I do not understand why I am getting this error.

See attached image of code and error. Please help me out with what should be an easy fix.https://postimg.org/image/fqildiji3/
My money is on the uneven size of your train_y and train_X.
I figured it out. It was because I did not have () at the end of classifier=KNeighborsClassifier lol wow I need to be able to better avoid these little bugs. What is this called when first assigning a classifier to a variable name like above? Why was it required that I have the ()?
What is this called when first assigning a classifier to a variable name like above?
An instance.

Why was it required that I have the ()?
It's the a syntax to call the class KNeighborsClassifier. Sometime you can have input augments.