Introduction to Machine Learning-1

What is Machine Learning?

Consider a situation where you want to purchase a particular soap. Obviously you want to purchase it as cheap as possible. So what do you do?

You compile a list of prices from different vendors, arrange them in ascending order and purchase from the first one.

We have 3 stores offering the soap at 3 different prices. What do you do?
Arrange them in ascending order

The answer is ₹ 12. Now, this is a problem that can be very easily solved using a computer program. There are many sorting algorithms available including Selection Sort, Bubble Sort, etc


How is Machine Learning different?

Now, consider an alternate problem.  The problem of crossing a road.

We have always crossed roads, but can you actually define the process.

Go to the edge of the road and start looking to the right. If there is sufficient space then look towards the right and then proceed.

Watch this video of a man crossing  a street

or that of a slightly more adventurous man.

Can we develop a computer programme that will decide the path to be taken by somebody wanting to cross a street?

Can we define it in terms of precise lengths, time intervals etc.

The answer is no.


But, people do cross streets and do it regularly with almost zero casualties.

Machine Learning can be used in developing a Chess playing computer program. Again it isn’t something that be defined as series of binary decisions, yes or no, true or false. Ask a grandmaster why he chose this particular move. He wouldn’t be able to give a very definite answer. He has learned that this is the correct move to make in this situation. Rather he feels that this could be best move.

Where is Machine Learning to be used?

Let us say we want to develop a Spam Detection system for an email application. How do we decide what is spam and what is not?

There is a person A who isn’t interested in films and gets an email from some film marketing company about new releases this weekend. Clearly, this is spam and we would send it to the spam folder. How will this be done? We will search for certain words, phrases like ‘new release’, ‘bumper opening of film’ etc and send all this to the spam folder.

However, there is a person B who has a deep and enduring interest in films so such types of email are not spam for him.

Clearly this situation cannot be handled in some easy binary logic fashion.

The program has to observe the email users activities for some time and learn from it. It is also possible that the user A might begin to develop an interest in films now. This means that the spam definitions have to change.


What type of a language is best suited for Machine Learning programming?

Machine Learning requires flexible and dynamic data structures and also complex numerical processing. Among all the currently available languages Python is the most suitable. If the data is to be stored in some database then it should be a non SQL database like MongoDB.


Explaining terms used in Machine Learning

Machine Learning

A Machine for us is a computer, mobile, robot, car or any other device or combinations of devices..
What do we mean by learning?

Teaching the computer to be good at recognizing patterns or events that humans can do. Let us understand this with an example.

Let us say you are running a taxi company. There are 3 sets of destinations that the company runs its taxis on.

  1. A to B, where A is a population hub while B is  hill station.
  2. The company also runs a taxi service from C to D where C is a population hub while D is a city with a tropical  beach.
  3. And finally from A to E where E is a convention center.

The company needs to decide on the number of taxis to be deployed on each route.

We shall have to appoint some managers who would continuously monitor the data and make decisions accordingly. Taxis to the hill station will decrease in winter and increase in summer. Taxis to the beaches would increase in winter.  The schedule would begin to fall into some pattern, Shifting would be done in late September or early October maybe and managers would make the decisions.

Now, what happens if you have a worldwide distribution network. Let us say your company is in the business of investing in stock markets worldwide. How do you distribute money worldwide for optimum benefit.


How to get the computer to make these decisions?

We need to make the computer software learn.

How would it learn. In the same way that solving a series of multiple choice questions makes you better at solving those types of questions. Playing chess makes you better at playing  chess. Watching a batsman play makes you better at predicting his shots.


The Internet and Volume of Data.

The other thing that makes Machine Learning  necessary is the sheer volume of data being produced.Think about the amount of text, audio, visual and video data on the Internet.

Then there is the the Internet of Things.

You have a Smart Phone, a House Alarm System, A Laptop, Kindle Device, Car, even a Microwave Cooker connected to the Internet. They all have unique IDs. You also have Software(Virtual) Devices like your Bank Accounts, Amazon Accounts, Stock Market Accounts, Airlines, Trains, Bus, Taxi company accounts and so on. All of these have unique IDs and are connected to the Internet. Now,we can have Machine Learning Systems controlling all this, making decisions and making life easier.

Think over it again and just imagine the future that is upon us.


Let us enumerate a few more terms used in Machine Learning.

Unsupervised Learning

is using unlabeled data to train a Machine Learning Algorithm.

Supervised Learning

is training a Machine Learning Algorithm using labeled data.

Imagine a situation where you attempt to analyze and make use of data accumulated on Twitter for a full day. Let us say we have elections in India and you want to derive some trends from this. This data is unlabeled, unstructured. This is Unsupervised Learning whereas the rainfall data for a country would be labeled and therefore Supervised Learning.

The rainfall data would be something like

City              |     Rainfall          |    Date

Varanasi             40mm              1-Aug-2019

Patna                  30mm              1-Aug-2019

Varanasi             35mm              2-Aug-2019


Unsupervised Data would be like

Mr X:  I will not be voting party A because I don’t like their leader.

Mr Y; I prefer a female leader.

This can help us predict results, classify people into groups of different party supporters, on the basis of causes supported etc

This is classification

This can help us predict results, classify people into groups of different party supporters, on the basis of causes supported etc


Fit the available data into a continuous valued function and make predictions.

Semi Supervised Learning

Some data is labeled but not all. For example Amazon item reviews of different products, from different regions etc.

Reinforcement Learning

Reinforcement Learning means adapting the algorithm to dynamic conditions via feedback.


Development of Machine Learning Algorithms

Logic Based Learning

Basically creating if else logic automatically by analyzing data. Making decisions about about which ad to display on a page. for instance.

Choosing a product based on requirements.

Statistical Learning 

Is analyzing data using statistical tools. Making predictions, finding relationships, classifying etc.

An example would be predicting stock prices. Classifying films as hit, superhit,flop etc

Neural Networks

Its an interconnection of different layers leading up to some classified output. The network then makes the decision about the direction to follow.

An almost literal example would be finding an optimal path between two places on an interconnected road map.

You provide weights to each road based on distance, road conditions, traffic conditions, etc.

Then pick an optimal path.

Genetic Algorithm

Find optimal configurations for devices using the biological process of evolution. To find an example you can go back to the Operations Research Optimization problems that you solved at college.

For instance

Minimize z=-x1 + 2×2
subject to the constraints
-x1 + 3×2<10
x1 + x2<6
x1>=0 and x2>=0

The working process would be

  1. Generate a population (you can use an array) of Zs that satisfy the constraints.
  2. Introduce some random mutation in the values of x1 and x2 keeping within the constraints
  3. Mate different organisms. This means producing new organisms (Zs) based on x1 and x2. New organism can have x value as the average of the x value of the 2 inputs.
  4. Repeat for a few generations till some criteria is met.better optimal values have stopped generating maybe.
  5. Find the optimal one

Deep Learning

is Neural Networks in many layers. One layer picks water bodies from a satellite image, the other layer checks for flooding, then for pollution and so on

Machine learning

is using artificial intelligence (AI) techniques that provides to  systems the ability to automatically learn and optimize from data. Machine learning software doesn’t require programmer intervention. Can adjust by themselves.

Next post, explaining Machine Learning Processes.





Leave a Reply

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