The 7 steps of machine learning

As you know, machine learning involves making a system LEARN by first showing it similar data . These are the 7 crucial steps of machine learning.

NOTE: everything in this article is just an overview of steps of machine learning. to get a real example refer to my Linear regression blog

gathering data

Lets say you are trying to make a program which predicts the age of a person by using the person’s weight and height. so first you need to collect data consisting weight, height and corresponding age of many people. you need to conduct a survey. you can use data you might find in your school, people you know, or even collect the data from the internet

preprocessing data

this step refers to a variety of processes designed to transform raw data into more readily used formats. of course you are probably going to use a programming language like python. so most likely you are going to store the useful data in a python list or array. maybe even randomize the data .you can also visualize the data in graph, you will probably notice there is a direct relation between the height and age of a person. one other important thing we do is split our data in 2 parts : training and evaluation. you will understand the reason in the training and evaluation part

choosing a model

many scientists throughout the history of machine learning have created numerous machine learning models. models refers to algorithm you use to get the prediction from an input. in our case the inputs are height and weight and the prediction is the age. in many cases the prediction you are supposed to make is not a number. it could be true/false, or maybe you are trying to classify the kind of disease by using its symptoms. in our case of predicting age we are going to use the model called ‘Linear regression’ . there are other models too like Logistic regression(used for binary classification like true/false), Convolutional Neural Network(used for image classification), and many more.


This is the most important step in the entire practice. this is where computer actually LEARNS. in this the model you chose is used to get prediction on the training data you have got. of course at first the outcomes would be wrong. because the model you have chosen doesn’t have the optimum settings. so first you use the first set of training data you have. lets say height of a person is 6 feet, and weight is 60 kgs and the age is 15. so the computer sees the input 6 and 60. then tries to get the age. and of course at first the prediction would be way off the real answer which is 15. the computer will realize its answer is wrong and try to optimize the model. to optimize, you need to use an optimizing algorithm, in our case we’ll use something called gradient descent. and of course there exist a number of optimizing algorithms too.


by using the evaluation dataset, you calculate how much accurate your model is by calculating its loss after fixed intervals, lets say after ten training steps. loss here means how wrong your model is on the dataset. again there are different types of loss formula for different kinds of prediction. in our example we can say finding loss can mean, what is the difference between the outcome of the model and the prediction. lets say the answer we are getting(age) is 14. but the actual answer is 15. so here the loss is 1. so we can say our model is pretty close to being good.

parameter tuning

using the insights we get from our evaluation step, we try to make small changes in our model manually.


finally, our model is ready for the purpose we made it. now we test our model in real life