Training & Testing in ML : The Building Blocks of Machine Learning
Training & Testing in ML : The Building Blocks of Machine Learning

In the world of machine learning, Training, and Testing are fundamental concepts that play a crucial role in building and evaluating models. Let’s dive into what they mean.

Training is like teaching a machine learning model to learn from examples, just like how we learn from practice. We give the model a bunch of examples (data) along with the correct answers (labels), and it tries to understand the patterns and relationships in the data. This process is called training the model.

Let’s understand how we all were trained in our exams

  • Assume this is how we as students are trained before our board exams by the great teachers in school/college with different forms of tests to prepare us for our final exam.
  • It would be unit tests/term exams/revisions/surprise tests, etc., here we are used to training on various combinations of questions and mixed scenarios.

( Trying to solve lots of sample papers and books ( R.D Sharma in Maths ) and study them overnight so that we can get the pattern of all types ( scenarios ) in sample paper so that during tests we can perform well.

Let’s understand in terms of sports

Do cricketers practice with different bowlers in nets ( Sample )?

( Leg Spinners, Fast Pace with different bowlers during Net )

Well, all that we want to train well during training time (Practice) and give our best during real-time matches. ( Unseen data or deliveries )

Surely Training makes man & Machine Learning model perfect !!

Now think this way what if Sachin Tendulkar had always practiced only one bowler ?

Quick Question

Will he be able to perform well

                 OR

Think if you had only practiced for some specific test questions during your exam preparation. – Will you be able to perform well in your exam?

That’s the complete idea of training the machine learning model with every possible data pattern available in the test sample to perform well on the training sample.

Python code is as simple as you think

from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y)

Key Takeaways:  The Mantra is

                                                              OR this can also be achieved

ABOUT THE AUTHOR

Harshit Sanwal

Harshit Sanwal

Marketing Analyst, DataMantra