# Six Infinity Stones of Machine Learning

All of you will be aware of Marvel’s Six infinity Stones, but do you know Six Infinity Stones of Machine Learning which together can make any machine the most powerful one? If no, go ahead!

This article presents Machine Learning Elements through a different perspective. But before that, there are few things to be discussed on a couple of **‘Expert System’** applications.

**Resume Recommendation System:**

Imagine, you want to pick the suitable resumes among thousand resumes that have flooded for an opening in your company. It is a time-consuming task to skim through each resume. How can a resume recommendation system help here? It will start looking for the apt keywords those pertain to the skills required for the posted job and filters out the right set of resumes.

Let’s say we want to see if a person has minimum required years of experience (in this case ,it is 3), whether the person changes a company frequently or not, whether the person is within the organisation’s budget, or if the person is available to join within a month and so on. Considering the things mentioned above, we’ll take some decisions and will hard code an expert system.

For a given set of data, we generate some set of rules manually to shortlist the resume.

**E-mail classification system:**

Now let’s say we want to design a system that can detect whether a mail is a SPAM or HAM. The features of a mail can be in millions that will keep changing. So, writing an expert system and detecting the patterns will be a mess. Apart from that, updating the system will obviously be ‘out-of-question’.

Now to the point, the building blocks of these expert systems are the ‘Infinity stones’ of the Machine learning. It is difficult to build an expert system without these blocks. To avoid the pain-staking job of hard-coding, it is imperative that machine learning should be incorporated! You can get the Expert System code as output, once you feed in the data and your work will be done for you. No harder manual coding, no more pain.

**Six Infinity Stones of Machine Learning**

Now, talking about machine learning, let’s first try to understand the elements of machine learning; this will help you building your expert system in just a snap of the fingers.

**DATA**

21^{st} century has produced a lot of internet-savvy folks; needless to say, you have a lot of data for crunching, munging and playing around. Web is the most abundant place for getting data, for example *Medium, Zomato, Reddit, Quora* etc have a lot of ** Text Data**,

*Google Images, Instagram, Shutterstock*etc have a lot of

*Image Data,**Youtube, Netflix, Amazon Prime*etc have

*Video Data**, Gaana, JioSaavan, Spotify*etc have a lot of

*Audio Data.*All you need to do is collect some data through scrapping (BY ETHICAL MEANS! ) and start working on it. So, “USE THE DATA”.

Some common places to collect open data are Kaggle, Google AI, UCI ML Repository, data.gov.in

Else you cook your own data.

**TASK**

Once you get the data, start exploring the data. For example, let’s take a video page from YouTube as shown below.

Now, we need to define the tasks we can do using machine learning. In this case, can I see the whole video and generate the description file (as shown in the middle) automatically? Or with just the audio file of this video, can I add subtitles to it in real-time without making them manually? Or taking the genre of this video, can I suggest similar videos to the user (just like the thing done on the right most side) Or can I do sentimental analysis by collecting the comments on the video and see the response(s).

**MODEL**

Now, after we have the data and we know what we want to do with our data i.e. the task, we now must see which machine learning model to use for the task. By model, I mean how do you want to approximate your output function such that it overlaps the actual output function as much as possible.

For example, we have a sine function which is f(x) in the case below, the function to be approximated. And we approximate it by some function F(x), which will be decided by the model we choose. So, in this case, we choose a model which gives us the best approximation for a sine wave.

Approximating the function using a model.

**LOSS FUNCTION**

After getting the data, defining the task and selecting the model to perform the task, we need to select a loss function. Loss function is the fulcrum of our model; our goal is to minimize the LOSS.

For example, in regression, our loss function is the sum of the square of “actual minus predicted” values. The equation is given below. In this case, we want to minimize the loss function (L(Φ)) and that will be the aim for to work on, as stated previously.

Sum Square Loss Function

Some common Loss Functions are Sum Error Loss, Cross Entropy etc.

**LEARNING ALGORITHM**

Now, after we have the above 4 things, we need to choose a learning algorithm which can make the model to learn the parameters as accurate as possible.

Let’s say we have an output function like “a*x*³ + b*x*² + c*x + d” *which can approximate well to the actual function* 1.45x³ + 2.98x*² + 5*x + 10. *How will our model learn these parameters ?

It will learn using learning algorithm which will learn these parameters i.e. a,b,c,d from the training data and minimize the loss function, which in turn will give us the best fit parameters for our function.

Some common Learning Algorithms are Gradient Descent, Adagrad, RMSprop etc.

**EVALUATION**

Now after having the above 5 things, the path to last infinity stone is selecting the Evaluation function. Don’t get confused between the loss function and Evaluation function.

Loss Function is the function which needs to be optimized in the best way by our model and Evaluation function will tell us how well our approximation function has fit to the unseen data after training.

Some common Evaluation Functions are

(Right Predictions / Total No. of Predictions)*Accuracy*(Right Prediction / (Right Prediction + Wrongly said Right Predictions))*Precision*(Right Prediction / (Right Prediction + Wrongly said wrong Predictions))*Recall*

**Conclusion**

After reading this whole article, you should be knowing about the 6 Elements of machine learning which are most powerful when combined. I hope it will be easy for you to collect the data and choose these infinity stones from now and after that you just have to snap your fingers to get started