# How to find the right number for a training set for machine learning

I would like to develop a machine learning algorithm using the knn model to perform a classification of my data records. My question is: is there a general method to follow to determine how large my training dataset should be?

• Basically as big as possible : the more data you have, the better your training will be. I guess the question is more "What's the minimum number of samples to have an acceptable training set ?" Sep 7 at 9:47
• so..... What's the minimum number of samples to have an acceptable training set? Sep 7 at 9:48

• The main problem when the training set is too small is the risk of overfitting. Thus if a model is overfit when trained with $$N$$ instances then it's an indication that $$N$$ is too low. Overfitting is usually detected when the performance on the training set is much higher than on the test set.
• More general: an ablation study consists in evaluating models trained with different number of instances, and observe their performance as a function of the size. If the performance becomes stable around size $$N$$ then this shows that $$N$$ instances is sufficient.