Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7833921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:58:13+00:00 2026-06-02T12:58:13+00:00

Could someone please tell me whether the training sample sizes for each class need

  • 0

Could someone please tell me whether the training sample sizes for each class need to be equal?

Can I take this scenario?

          class1   class2  class3
samples    400      500     300

or should all the classes have equal sample sizes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:58:14+00:00Added an answer on June 2, 2026 at 12:58 pm

    The KNN results basically depend on 3 things (except for the value of N):

    • Density of your training data: you should have roughly the same number of samples for each class. Doesn’t need to be exact, but I’d say not more than 10% disparity. Otherwise the boundaries will be very fuzzy.
    • Size of your whole training set: you need to have sufficiently enough examples in your training set so your model can generalize to unknown samples.
    • Noise: KNN is very sensitive to noise by nature, so you want to avoid noise in your training set as much as possible.

    Consider the following example where you’re trying to learn a donut-like shape in a 2D space.

    By having a different density in your training data (let’s say you have more training samples inside of the donut than outside), your decision boundary will be biased like below:

    donut-bad

    On the other hand, if your classes are relatively balanced, you’ll get a much finer decision boundary that will be close to the actual shape of the donut:

    enter image description here

    So basically, I would advise trying to balance your dataset (just normalize it somehow), and also take in consideration the 2 other items I mentionned above, and you should be fine.

    In case you have to deal with inbalanced training data, you could also consider using the WKNN algorithm (just an optimization of KNN) to assign stronger weights to your class that has less elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please tell me which objects types can be tested using Regular Expressions
I've recently written this with help from SO. Now could someone please tell me
Could someone please tell me whats wrong with this code because I cannot find
I wonder whether someone can help me please. I've put together this page, which
Could someone please tell me how can I change the default css of a
could someone please tell me, why this code for the freaking hell, doesn't display
Could someone please tell me how I can make the icon for my app
Could someone please tell me how I can use find_by_attribute with a variable which
Could someone please tell me if this is possible in C or C++? void
Could someone please tell me how I can declare multiple helpers within the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.