Python Forum
Python for machine learning, complete beginners
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python for machine learning, complete beginners
#1
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/
Reply
#2
My money is on the uneven size of your train_y and train_X.
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply
#3
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 ()?
Reply
#4
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.
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  A class of machine learning programs Led_Zeppelin 0 488 Jul-13-2023, 01:17 PM
Last Post: Led_Zeppelin
  Python Serial: How to read the complete line to insert to MySQL? sylar 1 822 Mar-21-2023, 10:06 PM
Last Post: deanhystad
  Python multiprocessing Pool apply async wait for process to complete sunny9495 6 6,431 Apr-02-2022, 06:31 AM
Last Post: sunny9495
  Question from complete python's newbie Davicom 3 2,373 Jun-09-2021, 06:09 PM
Last Post: bowlofred
  Question on None function in a machine learning algorithm Livingstone1337 1 2,363 Mar-17-2021, 10:12 PM
Last Post: supuflounder
  Python Complete novice: Want to run a vulnerability script bhanney23 1 2,989 Sep-18-2020, 09:27 AM
Last Post: Aspire2Inspire
  Get list of Video Device in python on Windows machine Michal 1 10,502 Apr-03-2020, 06:57 PM
Last Post: Mateusz
  Want to learn Python compilation and virtual machine IJB 3 2,626 Feb-14-2020, 02:59 PM
Last Post: IJB
  Best method: Python script called from another app, package as complete executable ironfelix717 2 2,130 Jul-24-2019, 07:39 AM
Last Post: DeaD_EyE
  machine learning error (using jupyter) calonia 1 4,144 Jun-26-2019, 05:16 PM
Last Post: ThomasL

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020