I'm new to deep learning and missed some intuition while learning Artificial Neural Network model building.

When I consider some Supervised ML's like linear regression, Naive Bayes or SVM etc, we split the dataset into training and test data set (lets keep the validation set concept aside for a while). Model is built from patterns learnt from training dataset and then model is applied to test dataset to check the accuracy of the model.

But when we consider ANNs, the output layer will compare the predicted value (y-hat) of every observation (every row) with the actual value (y) and calculates the cost function and adjusts the weights accordingly.

So is it required to split the data into training set and test set and check the accuracy of the model performance in Deep learning?

Please correct me if i'm wrong.

Went through this link. But didn't help.

  • $\begingroup$ Just like other ML algorithms, you need to split your data for cross-validation when using neural networks. $\endgroup$
    – kedarps
    Oct 13, 2017 at 15:08

1 Answer 1


What you're describing that NNs do in the third paragraph is also done in linear regression, logistic regression, and many other supervised learning methods. (SVMs do it too, but in a more subtle way.) It may not be obvious in the case of linear regression because the value of the weights is given by an explicit formula (rather than an iterative procedure), but that formula represents the value of those weights that minimize the cost function between what you're calling $y$ and $\hat{y}.$ Neural Nets do the same thing, but because there isn't an explicit solution to the weights that minimize the cost function, it searches for that minimum through an iterative procedure.

Minimizing the cost function does not achieve the same thing as testing the accuracy of the model on a separate test set. It's true that, when you finish training a model on a training set, the model you now have is the one that will get the best prediction values on that same training set (given the assumptions of the model), where by "best", I mean the predictions that would give the lowest result of the cost function. However this says little about how well the model will generalize to other data outside your training set, which is ultimately your goal. It is possible that a very strong fit to the training set can be a result of overfitting, which means that the value of the cost function evaluated on a test set will be much higher than that on the training set. The test set is meant to check to see if you are overfitting. I argue that it is important for any supervised learning method, including neural nets.

Here's one analogy I like to use to illustrate the concept of overfitting. Imagine you're a professor who will be giving an exam tomorrow. You have two students, student $A$ and student $B.$ To student $A$ you give a practice exam with which to study. The practice exam has no overlapping problems with the actual exam, but tests an understanding of similar concepts. To student $B$ you give a copy of the actual exam for studying. After they both take the exam and you grade it, which of the two results is a better indicator of that student's grasp of the concepts, or their ability to take future exams in the subject?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.