Introduction To Machine Learning and Comparison With Traditional Programming

Machine Learning and Data Science are some of the most exciting areas in which people are attracted to make a career. As per several industrial surveys, the demand for jobs in these sectors is at its peak. Companies across every industry are collecting data in some form. For example, a vehicle company collects data about how their vehicle performs on the road and is devoted to making their customers' experience “the best”. At the same time, a milk farming company collects data of their sale and analyzes when their firm needs an extra amount of milk to serve their customers better. 

Companies collecting data

Source: Eric Griffith blog

Similarly, every company talks about collecting data, analyzing it, extracting meaning, and finally building technologies around it. Each of these stages creates job opportunities like Data Analyst, Data Scientist, Machine Learning Engineer, and many more. Through this article, we will start our career-focused journey towards one of these emerging technologies: Machine Learning. Here, we will explore the most fundamental and first ideas about this technology. 

Key Takeaways from this blog

  1. Analogy behind Machine Learning technique.
  2. What is Machine Learning?
  3. Difference between traditional programming and Machine Learning.
  4. Why do we need Machine Learning?
  5. Problems that traditional programming will be unable to solve, but ML can.
  6. Amazing facts in Machine Learning.

So, let’s begin our journey towards knowing this beautiful technology and find the answers to the above questions. 

An analogy from Human Brain

Have we ever thought about how our brain works? 

Let’s start from here itself! 

Indeed, the brain is the most complex part of our body, and the knowledge about its working principle is still big research underway. But to understand it, let’s take one simplest example. Suppose we want to catch the ball coming towards us. What would be our first reaction? We will use our hands to catch it, right?

Catch the ball

Let’s correlate this scenario in the format of input and output data. Our eyes sensed the incoming ball and sent the input signals to our brain. Brain received these signals, analyzed them, and finally generated the output reaction of moving our hands towards the coming ball to catch it.

To explain the same phenomena in biological terms, we can say that brain cells have perceptrons/receivers, named Dendrites, which receive the electrical signals as the input data from our sensory organs (Nose, Eyes, Skin, etc.). They analyze and respond to those signals by releasing reaction signals through the Axon terminals as the output data.

brain cells dendrites and axons

But would you be able to catch it in your childhood days?

In our childhood days, we might have faced difficulty in catching the balls. More and more, we practiced; our brains perfectly learned how to catch a ball. Similarly, there will be different sets of signals for any other task. The brain gives a matching set of output signals through axons when any known or similar set of inputs is received from dendrites. Saying more explicitly, it learns the mapping function from the input set to the output set.

Brain learning a function

This learning of mapping function through several experiences is known as intelligence in living things. But, what if some non-living things started doing the same?

Can we provide this same capability to our computers anyway? 

That’s where this buzzword “Machine Learning” comes into the picture. Let’s move towards understanding it in detail.

Machine Learning

We saw that human brains have a unique characteristic of learning from different experiences and evolving to do the best for similar experiences. Continuing the same example of catching the ball, suppose we want to make a Robot to catch the ball by providing him a human intelligence. Can you guess “how” we can do that?

Disney robot catching the ball

Source: Disney

There are two possibilities:

Method 1:

We can write a function-based computer program that will take the ball's location as the input parameter and give us the output position to place our robot to catch the ball. This method can also be called traditional programming.

if ball position is X1:
     place robot at Y1
elif ball position is X2:
     place robot at Y2
elif ball position is X3:
     place robot at Y3
.
.
.
So on....

Robot catching the ball for different positions

Method 2:

We recorded some data instances for the ball positions and corresponding robot positions (placed manually) to catch the ball perfectly. 

(X1, Y1), (X2, Y2), (X3, Y3), ..., (Xn, Yn)

Later, we asked our robot to predict its possible positions for the recorded ball positions one after the other. Let’s say we asked our robot to guess where it should be present to catch the ball, given the ball position is X1. Initially, the robot made very wrong guesses for its positions. Let’s say it guessed Y1' and the difference between Y1 and Y1' was very high. 

Machine predicting very wrong position

But our robot did not lose hope. It learned from its mistakes and corrected the predictions for every recorded ball position (X1, X2, …, Xn). Continuously trying for all these instances, it achieved the intelligence and started predicting its correct or near-correct positions (Y1', Y2', …, Yn’).

This type of Computer Intelligence gained from learning via different recorded experiences is known as the Machine Learning.

Once this learning has been done, it can predict the robot's position for any similar ball positions that were not recorded earlier. Let’s say for Xn+1, it will be able to give some output Yn+1', and we will decide the success by outcome whether it caught the ball or not.

Machine predicting correct position

Difference Between Machine Learning and Traditional Programming

Traditional Programming

Let’s say our robot was nothing but just a tiny computer. Suppose we try to represent the process of traditional programming using a block diagram. In that case, we provide a program to our computer along with the input data of the position of the ball. Our computers executed that program for that input data and provided the corresponding robot position as output.

Traditional programming process

Machine Learning

But in Machine Learning, we provided our computer some recorded experiences in the form of Ball position as input data and corresponding robot position as output data. Our computer somehow learns a way to convert Input data into output data. Or we can also say it discovered the program that we had to write explicitly in the traditional programming section. Isn’t it fascinating?

Machine learning process

Once our computer learns this program, it will perform similar functionality as traditional programming for any newer ball position (we don’t know the corresponding robot position for this ball position). It will take the newer ball position as the input data and use the learned program to calculate the corresponding robot position. That’s Machine Learning for you.

Machine learning process for un-recorded dataset

Machine Learning Definition

Before moving forward, let’s define “Machine learning” formally.

  • In 1950, the inventor of this term, Arthur Samual, said, Machine learning is the science of getting computers to act without being explicitly programmed.
  • And Wikipedia definition says: Machine Learning is a computer science field that gives computers the ability to learn without being explicitly programmed.

Did you notice something similar between these two definitions? 

In machine learning, we are not writing programs/functions. Instead, it is learning by itself based on the historical data, and that’s the core reason why both the definitions include the term “without explicit programming”.

Here computer takes Data and Output as its input parameters and tries to produce the best suitable function that maps Data to Outputs. The machine learns a mapping function that maps the input data to the output data using existing experiences (Similar to the brain’s functioning).

Why do we need Machine Learning?

As true learners, we encourage readers to ask themselves just one question,

We already had traditional programming using which we could have written thousands of lines of code. Then why do we need Machine Learning in such a scenario? In the earlier example of ball catching robot, what if we cover all the cases of robot positions using if/else conditions, and the robot can catch balls perfectly. Then why ML? Think for a while!

To answer this, let’s get back to our previous example of ball catching robot. The positions that a robot can take are finite. This means it can be anywhere inside the defined arena where we perform this circus of robots catching the ball. So using if/else conditions, we could easily cover all the scenarios. 

But what if we say that we have to code the self-driving car on the real road?

Will it be possible for someone to cover all the cases using traditional programming? Obviously not! The possibilities of scenarios can be infinite there. That’s where we need Machine Learning that can learn automatically for the different scenarios and modify the experience based on several new adventures.

Example Applications that can not be programmed traditionally

  • Self-driving vehicles: There are millions and billions of possible scenarios on the real road, and it might not be possible to write explicit programs for that.

Autonomous driving example

Source: National Geographic

  • Handwritten character recognition: There are billions of people out there, and two persons' handwriting barely matches. If we opt for traditional programming to identify the characters in the hand-written documents, we might never cover all the cases in the world.

Handwritten character recognition example

Source: Qt Documentation

  • Email Spam/Non-spam classification: Based on the content of the email, we classify whether that is spam or non-spam. Every professional person in the world daily gets around 150 emails on average. Suppose we traditionally programmed our computer that if an email contains these sets of words/links/phrases, then mark it as spam. Don’t you think spammers will quickly get the hint that their emails are marked as spam when they are sending these sets? They will easily find an alternative for that, and now we have to program our computer again for those alternatives.

Spam classification example

Source: Netcore solutions

  • Face Recognition: All computer vision tasks involve billions of image pixels (one unit of image). We can not explicitly write programs to perform functions on such a wide variety of pixels.

Facial recognition example

Source: Dribble

There can be many more such applications around us. If you can find some, please post in the comment section. 

If we have to define the technology application term “Automation”, we could say, when human involvement is minimized. We generally take the help of machines by programming them. 

So if a computer program is an automation, then Machine Learning is automating the process of automation

Traditional programming and machine learning

A breakthrough in machine learning would be worth ten Microsofts.

— Bill Gates, Former Chairman, Microsoft

Some mind-blowing facts related to machine learning:

  1. A Machine Learning model can learn to play the games from the expert’s experiences and then can beat the same expert. Google’s AlphGo is an ML model that defeated 18-time world champion Lee Sedol in a chess game.
  2. Google’s Deepmind has a separate branch of Alphafold that focuses on discovering drugs using machine learning. ML learns the working patterns of different medicines from earlier experiences and proposes drugs for any new disease.
  3. ML can be used for Code anonymization. Suppose a company has 600 programmers. Seniors decided to take eight code samples from each employee and train the ML model over that. Once trained, the algorithm could predict who wrote the code with 83% accuracy. Imagine how useful this could be whenever there are any Ransomware attacks.

Critical Questions to Explore

Question 1: Why did someone term it “Machine Learning”?
Question 2: What makes traditional programs different from ML algorithms?
Question 3: How can ML algorithms help in cyber-security?
Question 4: Why can some applications not be hand programmed?

Conclusion

In this article, we learned about machine learning and traditional programming. We understood how machine learning mimics human brains with an exciting example of a robot catching the ball. We hope you enjoyed the article.

If you have any queries/doubts/feedback/other ideas, please comment below or write us at contact@enjoyalgorithms.com

Enjoy machine learning, Enjoy algorithms!

Our Weekly Newsletter

Subscribe to get well-designed content on data structures and algorithms, machine learning, system design, oops, and mathematics. enjoy learning!

We Welcome Doubts and Feedback!

More Content From EnjoyAlgorithms