In this blog we will learn Machine Learning in 6 steps. We will also come across some technical terms used in machine learning. Some of these steps are done manually(which is usually a ML engineer job) and others are done by machine(which is why it is known as machine learning).

We will come accross various examples while learning these steps. And, the example for first 2 steps is to **detect whether the batsman is lbw out or not**. I know cricket fans’s heart beat might have gone up after reading previous line. Aiila cricket example😂, wo bhi padhai me. So Let’s begin with our first Step i.e **Tasks**

Tasks are broadly defined into 2 categories

**Classification**:- The classification tasks are those whose output values are in 0, 1. Like our current problem statement, detect whether the batsman is lbw out or not. And how to get the output we will see in later steps**Non-Classification**. For non-classification task the values of the output can be a set of values ranging from 0–1. Like based on a person annual salary and family members size, provide the probability of a person buying a car. If the output tends towards 0 like 0.2 he/she is very less likely buy the car and vice-versa.

**Step 2-DATA**

To solve any task in machine learning we require some data. In this case our data could be

- The ball pitched was a no ball or not?
- The ball pitched was inline with the stumps or not?
- Would the ball hit the stumps, if the batsmen was not present in front of wicket?

And some more, but you might have got the idea what kind of data we need to solve a problem. You can relate it to our mind as well. When we see the ball pitched we try to predict whether the batsmen is out or not based on what we see. Our mind also need some data to predict the outcome and the same goes for machine learning.

The data should be related to problem. This also is the job of machine learning engineer to collect the appropriate data from various methods. After collecting data, we divide it into 2 parts training data and test data. In can be divided into 9:1 ratio where 9 is for training and 1 is for etc or any ratio with which you feel comfortable.

**Step 3-Model**

This is the trickiest one, so try to bear with me on this and we would also require some elementary maths skills also to understand this step. There are thousands of models written out there from simple to very very complex. Model is nothing but a function which satisfies all possible input values. It is the job of the ML engineer to decide which one to use. Let’s take an example to understand this.

Here we have **x** as series of the input training data values and **y** as the actual training data output values of the corresponding **x **input.

If we plot those values of x and y graph and connect them it would look like this.

So job of the ML engineer is to find some maths relation/function/model through given x and y to predict the new values of y for the new x.

y in left hand side is the predicted values and f(x) in the right hand side of above equation is the function/some model that is trying to predict the y. Therefore will plugin the values of **x** in the **f(x)** to get the prediction.

And 🤯 Sab upar se nikal gya😂😂. Let us try to understand this by taking some examples.

Let’s start with very simple and basic linear function i.e

## y = mx + c

If we plug in values of x in above function and get the value of y. After plotting those values it will look something like below graph

We can clearly see our function(green line) does not pass through or nearby from the original inputs. This means our function is not efficient. Therfore We need to try another one. As I stated above there are thousands of function from which we have to select. And in real problem case cannot even see the data to visualise the function so the only methods to find the function is the calculative intuition. The model/function that would likely satisfy our problem is the below one

And this is the graphical representation of this function. We also need to find the values of the a, b … coefficients, to get the most efficient result. Luckily that is the work of machine, we need not and in 99.9% of the cases cannot predict those values. So this is the work left for machine.

We just need to find the function that looks similar to the input. So now i think you have got some hint what the model is.

**Note:- **There could be other functions also that could satisfy our problem in much accurate manner. It is just we need to find them & set some bar with how much accuracy we can live with.

Most of you might be thinking acha ye hota h function. So that’s it with the model part. And now we move on to next one

**Step 4-Learning Algorithm**

After selecting the model, we need to find the values of coefficients. And for that we need learning algorithms. These algorithms can be as simple as brute force in which we try each and every value starting from 0 to number of times you set to the complex algorithms. But just understand the basic motive of Learning algorithm is getting the values of coefficient where the highest accuracy of our model lies. Various example of learning algorithms could be brute force, perceptron learning algorithm etc.

**Step5-Loss function**

In many cases our learning algorithm needs to know how much change in the coefficients values is required to reach the desired output. This is where loss function comes into play. The loss function is used to check the loss given by our predicted output compared to the actual output.

If the loss is very less let’s say 0.5 this means we need little adjustments in coefficients to reach the highest accurate results. And if the loss is like 1.5 that means, we need to change the coefficients with much more adjustments. If the loss is 0 that means the accuracy is 100% and we need no more changes. But in ideal scenario there is very less chances of getting that accuracy.

It is hard to quantify by just looking at the values of loss and predict the accuracy that is why we have another step accuracy for that. Loss function is used to get some hint how much adjustment our learning algorithm need to make in coefficients to reach the highest accuracy possible. Some examples of Loss functions could be square at a loss function, square mean loss function etc.

**Step-6 Accuracy**

As we study whole year and give test at the end to evaluate ourself. This is the test of our model. This is where you will see how much your efforts paid of. And luckily it is one of the easiest one. We can check our accuracy by looking how much predictions we have got correct. Let us say we got 3 out of 5 predictions right therefore the accuracy is 60%. It means we need to work more on our model.

Setting the bar is setting how much accuracy we can live with. One point to note here is we do not check accuracy on training data. As it will definitely provide more accuracy. Therefore we find accuracy on the test data. There are multiple formulas out there to find the accuracy of model like R-Squared, Mean Squared Error, F1 Score etc.

**Conclusion**

Above we have read 6 steps of Machine Learning process. Which starts from thinking about the task, collecting relevant data of the task, splitting the data into 2 parts training data and test data, selecting model based on data, applying learning algorithm to find coefficient of the model, applying loss function to get fast results from learning algorithm and in the end applying that model on test data to find out how accurate our model is.