# Is it required to split the data into train and test set in Artificial Neural Networks?

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.

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

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.
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?