Shiv Maharaj — Published On March 9, 2021 and Last Modified On March 10th, 2021
Beginner Interview Questions Machine Learning


As we enter future times, man is trying his best to uncover all the secrets of technology. Looking back at a famous quote that was once said by Mark Cuban:

Artificial Intelligence, deep learning, machine learning- whatever you’re doing if you don’t understand it- learn it. Because otherwise, you’re going to be a dinosaur within 3 years“.

The aforementioned words tell us just how rapidly we have evolved in technology. However, in modern times, the race to create world-changing technologies has never been so real. Every being in this world wants to create a technology that is said to out-do a human a hundred-fold- it is said to become the beginning of a new era in which a machine could possess the ability to govern the world, the era in which world peace could be threatened. It is known as ASI- an Artificial Super Intelligence. It’s the basis- Machine Learning. Let us touch the surface and dive into the depths of Machine Learning.

Machine Learning introduction

Source: Forbes

The history of Machine Learning

Going back a few decades into the past, Machine Learning is thought to have originated around the early 1960s, a few years after the first computer systems were invented. The term “Machine” represents a computer, mobile phone, or any device that comprises electric circuits and which needs electrical power or a power supply to function. “Learning” refers to an object’s ability to isolate, discover and replicate patterns and use these to carry out tasks- much like how the human being functions.

Machine Learning is often abbreviated as ML. The computational power and benefits of ML were not brought to light until recent times. As time goes on, the versatility of ML is only expanding.


ML in the modern days.

ML is one of the most trending topics in the fourth industrial revolution. In the field of Machine Learning, we make use of programmers(developers) and programming languages to conduct the teaching and learning processes, respectively. Examples of popular Machine Learning programming languages include, but are not limited to, Python, Java, C++, C#, JavaScript. The main aim of ML is to teach the computer how to use its past experiences to perform better in the future.

It is essential to know that in Machine Learning, a programmer will not explicitly hard code all possible program outcomes. Instead, the developer will program the application’s ability to learn- Based on what this application has learned previously, it utilizes this to decide on outcomes for present or future problems. The point of reference that a machine uses for learning and is used to learn from is known as a model.

Machine Learning in the modern days.


Source: Depositphotos

In ML, the model is generated by algorithms. An algorithm is simply a set of rules/instructions that is followed by a computer or any object when it is performing a certain task. These algorithms have parameters, which are basically the “settings”. By us tampering with the “settings”, we can adjust how the computer learns from the data at hand, and ultimately, we are changing the model that is being compiled as the outcome.

So, we now know that changing the values of the parameters, will cause a different model to be generated.


The Machine Learning framework

Before we discuss the different types of Machine Learning, we must understand the learning framework that exists around Machine Learning, while using an example scenario. Suppose you visit a store that sells varieties of grapes and it is the first time you ever set foot into the store.

Since you have no experience with the nature of grapes that the store sells, you decide to taste all the grapes and label them in groups according to their physical properties such as color. After a repeated tasting of the goods, you reach conclusions of your own as to which grape is suitable for you to buy. You have concluded your tasting and are now know which grapes will be sweet or sour.

Looking back at our example, we see that the conclusion you have reached is based on a sequence of events that occurred during the duration of the training and testing stages. Keeping the latter statement in mind, the Machine Learning framework is comprised of ML Input, Data Model, ML Output, and Measure of Success.

Identifying our framework events using the previous scenario, our Machine Learning event will be as follows:

1. Machine Learning Input: This is the first part of the ML framework that we encounter. For this, we had to taste all the grapes, find a fixed set of grape properties, and focus on them for the duration of the problem, for it will be these properties that will assist us in choosing better grapes each time we sample an individual grape. During the tasting of the grapes, we decided to label them into groups based on their physical properties and taste. The grapes that taste good are the ones that we were aiming to reach and therefore this group will be called the “training’ group. It is because each time we sample a grape, the ‘training’ group of grapes will help us to make better predictions as to whether a grape will be sweet or sour or not.

2. Data Model: Upon tasting sufficient grapes, we have grown the groups of grapes large enough (e.g., Group one has 10 grapes all of which are red-yellow and taste sweet; Group 2 has 10 grapes all of which are green-blue and taste sour). With enough data in our arsenal for sweet and sour grapes, we can confirm that we are gradually becoming increasingly aware of which grapes are sweet and which are sour, therefore reinforcing the fact that we are gaining experience and are building up a model which we are using as a point of reference for learning. It is this model that helps us to tell beforehand if a grape will be sweet or sour. With a model, you will have assistance with selecting the sweet and sour grapes- even if it is your first time.

3. Machine Learning Output: With the model, you have created, you would like to have sound output. The output part of the Machine Learning framework is what involves authenticating that your model is true. During the initial stages of the process, you did not possess any experience to assist you with the classification of sweet and sour grapes. However, after training, you have gained enough experience to make you aware of predicting which grape may be sweet and which may be sour. This part of the framework enables you to, with some certainty, decide beforehand whether a grape will be sweet or sour.

4. Measure of Success: This is referring to the level of accuracy that you have achieved. If you were to allow your model to guide you entirely while conducting a grape taste, is your model’s guidance correct? Does the grape taste exactly how the model says it should taste? It is important to note that the success of the model in our scenario, does not necessarily mean you choose sweet grapes all the time. The success factor is dependent on and defined by what you want to see as the outcome at the end. If you are looking for sweet grapes then that is your measure of success, however, if you are looking for sour grapes then that will be it.

The Machine Learning framework

Source: NDTV Food


Different types of Machine Learning.

Machine Learning requires an input of data- and in the present day, data is available everywhere. The data will take the form of a table. This table will comprise rows and columns. The rows are referred to as observations, and the columns are referred to as features. The portion of the information that
is used to teach the model how to make predictions is called the Features Matrix (Matrix because it has more than one dimension). The portion of the information that we want to predict is called the Target Vector (Vector because it is one-dimensional).

You may often see that the Target Vector is referred to as ‘Labels’. Our algorithm will make use of the Features Matrix and try to figure out the best possible way to teach the model to achieve the most accurate prediction results. Many different types of Machine Learning exist, with four main categories. Each type of Machine Learning has been named according to the nature and type of algorithms that fall within the specificcategory.

Category 1- Supervised Machine Learning.

In this type of ML, we have data that is passed to the learning algorithms and it is composed of a features matrix and a target vector. Supervised Machine Learning consists of the following algorithms: Linear Regression, K-Nearest Neighbors, Naïve Bayes, Decision Trees, Random Forests, Logistic Regression, Support Vector Machines (SVMs).

Category 2- Unsupervised Machine Learning.

This category of Machine Learning consists of Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA), Clustering algorithm, Markov algorithm, and Neural Networks. When we deal with these algorithms, we pass in a features matrix only. Hence, this means that we do not pass in a target vector. Without a target vector, the unsupervised machine learning algorithms do not have any experience with how to use the features matrix to reach the result, and so these algorithms are left to draw their own conclusions from the data.

For understanding purposes, we shall have a brief explanation of Neural Networks. Specifically, we will talk about Feedforward Neural Networks- so named because data is ‘fed forward’, deeper and deeper into the network-, also known as Multilayer Perceptrons or MLPs. Within this Neural Network there exist three types of layers. At the start of the network, there is an Input Layer. At the end of the network, there is an Output Layer. Between the Input- and Output-Layer, there is a Hidden Layer. The interesting part is that there is no fixture on the number of hidden layers that need to exist in the Neural Network. So, what we are saying is that there may exist an unlimited number of hidden layers between the input and output layer. These neural networks with many hidden layers (e.g., 100), are referred to as ‘deep’ neural networks, and their field is known as ‘Deep Learning’.

Category 3- Semi-Supervised Machine Learning.

Semi-Supervised Machine Learning involves us providing input data- this input data will consist of a large portion of the data being unlabeled, i.e., not having a target vector, and a small portion of the data being labeled, i.e., having a target vector. A disadvantage of Semi-Supervised Machine Learning is that it takes a lot of time and effort to obtain a dataset in which there are labeled and unlabeled data. It is said that any of the previously discussed algorithms can be utilized for Semi-Supervised Learning.

Category 4- Reinforcement Learning.

This category of Machine Learning is based on an “action reward” system. The main aim of reinforcement learning is to teach the machine correct from incorrect. There are three main principles in reinforcement learning.

1. Present State- this describes the current position of the machine.

2. Action- this describes the action that the machine needs to take.

3. Reward- this is the reward that will be given to the machine if it has made the correct decision or provided the expected outcome. For example, giving a binary one (1) will indicate to the machine that it is correct, hence enabling the machine to perform better the next time; and giving a zero (0) will indicate incorrect performance.

When a machine acts in its present state, it will receive a reward if it has succeeded in its attempt.

Source: CFA institute

Source: CFA institute

This concludes my article on Machine Learning.

Thank you for your time.

About the Author

Our Top Authors

Download Analytics Vidhya App for the Latest blog/Article

Leave a Reply Your email address will not be published. Required fields are marked *