Introduction to Machine Learning

In the most recent and trendy advancements in the technical domain, Machine learning and Data Science are the most rapidly growing fields. Companies in every sector collect every possible data in one form or another. With such massive databases, the demand for utilizing collected data is increasing rapidly to improve customer experiences and understand operations better.

For example, a vehicle company collects data about how their vehicle performs on the road. Similarly, a milk farming company collects data on their sale and analyses when their firm needs an extra amount of milk to serve their customers better. Such extraction of meaningful insights from data has become the new trend.

Hence, based on several industrial surveys, job opportunities for roles of Data Scientists, Data Analysts, Machine Learning Engineers, and AI Engineers are increasing day by day. In this blog, we will begin our career-focused journey in machine learning by exploring its fundamental concepts.

Key takeaways from this blog

  • What is machine learning?
  • Why do we need machine learning?
  • Difference between traditional programming and machine learning.
  • Amazing facts related to machine learning.

An analogy from human brain to understand machine learning

The brain is the most complex part of the human body, and researchers are still uncovering its workings. To better understand the brain, let's consider a simple example. Imagine a ball coming towards us. What would be our first reaction? Most likely, we will use our hands to catch the ball.

Behind the scene, this can be translated into input and output. Our eyes sense the incoming ball and send input signals to our brains. The brain receives these signals, analyzes them, and generates the output reaction of moving our hands to catch the ball.

In biological terms, brain cells have perceptrons or receivers known as dendrites that receive electrical signals as input data from our sensory organs such as the eyes, nose, skin, etc. The brain cells analyze these signals and respond by releasing reaction signals through axon terminals as output data.

brain cells dendrites and axons

In our childhood, we may have struggled with catching balls. However, through practice, our brains eventually learn how to do so. During this process, the brain effectively learns the mapping function from inputs to outputs. In other words, the process of learning a mapping function through repeated experiences is referred to as intelligence in living beings. Now the critical question is: What if some non-living things start doing the same? Can we develop the same capability for our computers? That's where the concept of "Machine Learning" comes into play.

How brain works?

Let's understand machine learning via an example

We saw that human brains have a unique characteristic of learning from different experiences and evolving to do their best for similar experiences. Continuing the same example of catching the ball, we want to make a Robot catch the ball. How can we do that? There are two possible solutions.

Method 1: Using traditional programming

We can write a computer program that uses a function-based approach to catch a ball. The program will take the ball's location as input and output the position where the robot should be placed to catch it. This is the idea of traditional programming.

How traditional programming works?

Let's understand this from another perspective. Suppose our robot is nothing but just a tiny computer. In this case, we can represent the traditional programming process using a block diagram. We input the ball position as input data, and then the computer executes the program and outputs the corresponding robot position. For example, let's simulate this using multiple if-else conditions.

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....

Method 2: Using machine learning

Suppose we have recorded data for ball positions and corresponding robot positions, (X1, Y1), (X2, Y2), (X3, Y3), …, (Xn, Yn), where X is the ball position, and Y is the robot position to catch the ball. Now we ask our robot to predict its possible position for the recorded ball positions one after the other. For example, if we asked the robot to predict its position when the ball is at X1, the robot initially stated incorrect positions, and the difference between its guessed positions (Y1') and the actual position (Y1) was significant.

Now our robot learned from its mistakes and continually corrected its predictions for each recorded ball position (X1, X2, …, Xn). Through this process, it eventually achieved an intelligence level and started predicting correct or nearly correct positions (Y1', Y2', …, Yn'). This type of computer intelligence obtained from learning through various recorded past experiences is known as Machine Learning.

Once the learning process is complete, our robot can predict positions for new and unseen ball positions, such as Xn+1. It will provide an output, Yn+1', and the success of its prediction can be measured by whether the ball is caught or not.

How machine learning works?

From another perspective, we provide our computer historical experiences in the form of ball position as input data and corresponding robot position as output data. The computer then learns how to convert the input data into the output data. In this process, it discovers the program that we had to write in traditional programming explicitly. Isn't that fascinating?

Once the computer has learned this program, it can perform similar functionality as traditional programming for any new ball position, even if we don't know the corresponding robot position. It takes the new ball position as input data and calculates the corresponding robot position using the learned program. This is what Machine Learning is all about.

Difference between Traditional programming and Machine Learning

Traditional programming is about writing code to define how the computer should perform a task explicitly. The programmer must specify the rules for the computer to follow, and the computer will execute those rules regardless of any changes in the data. This approach works well for simple and well-defined tasks.

In contrast, Machine learning is a way for the computer to learn how to perform a task without being explicitly programmed. Instead of specifying the rules, the programmer trains the computer on data, allowing it to analyze the data and find patterns. Now computer uses these patterns to make predictions or decisions without the need for additional programming. In other words, the programmer provides the computer with a set of past experiences in terms of data, and the computer uses algorithms to learn from those experiences.

Machine Learning Definition

Before moving forward, let's define "Machine learning" formally.

  • Arthur Samuel, the inventor of the term, stated in 1950 that "Machine Learning" is the science of getting computers to act without being explicitly programmed.
  • According to Wikipedia, Machine Learning is a computer science field that enables computers to learn without being explicitly programmed.

Did you notice the similarity between these two definitions? In Machine Learning, the computer learns from historical data instead of writing programs or functions. That's why both definitions include the phrase "without explicit programming."

The computer takes input data and output data as parameters and tries to find the best suitable function that maps the input data to the output data. Similar to the working of the brain, the machine learns this mapping function using existing experiences.

Why do we need machine learning?

Why do we need Machine Learning if we already have traditional programming, which allows us to write thousands of lines of code? For example, consider the ball-catching robot example. What if we use if/else conditions to cover all the cases of robot positions? Why use Machine Learning, then? The answer is simple: a robot's positions are limited, which can only be in a defined arena where we catch the ball. But covering all scenarios using if/else conditions would be challenging if we keep increasing the arena for our robot.

Consider coding a self-driving car on the road. Can someone cover all cases happening on the road using traditional programming? No, the possibilities of scenarios are infinite. That's where Machine Learning comes in. It can learn automatically for different scenarios and improve its experience based on new experiences.

Other example applications that can not be programmed traditionally

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 handwritten documents, we might never cover all the cases.

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. Would spammers likely quickly get the hint that their emails are marked as spam when sending words from these sets? They will easily find an alternative, and now we have to program our computer again for those alternatives.

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 various pixels.

If we have to define the technology application term Automation, 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 automation process".

Some facts related to machine learning

  • Machine Learning models can be trained to play games and outperform experts. For example, Google's AlphGo defeated 18-time world champion Lee Sedol in a chess game.
  • The Deepmind branch of Alphafold uses Machine Learning to discover drugs. The model analyzes past experiences to find patterns and suggest treatments for new diseases.
  • Machine Learning can also be used for code anonymization. For instance, if a company has 600 programmers, the senior staff can take 8 code samples from each employee and train an ML model. After training, the algorithm can predict who wrote the code with 83% accuracy. This technology could be precious in case of ransomware attacks.

Enjoy learning, Enjoy algorithms!

More from EnjoyAlgorithms

Self-paced Courses and Blogs