A Simple Introduction to Machine Learning

Techmentry
8 min readJun 24, 2021

--

“Artificial Intelligence is the New Electricity” — Andrew Ng

Artificial Intelligence and Machine Learning are expected to change the way we live, work and play in the coming years. In terms of their transformative capabilities, AI & ML have been compared to the way the advent of Electricity changed our lives a century ago. We are already living in the AI Era. Machine learning is all around us already. It is only going to get better from here, considering the pace of research and innovation happening in these domains today compared to a few decades ago. If you have developed an interest in these areas and want to learn more, you have come to the right place.

In this blog, let’s try to understand in simple terms, what exactly is Machine learning? How is it already all around us?

Consider the following situations:

Source: Lazar Gugleta, UnSplash

  1. Playing Chess/Ludo/ any other video game with the computer and losing to it!!!!
  2. Asking Alexa to play your favorite song
  3. Facebook automatically recognizes and tags your friends’ faces whenever you upload any photo with them.
  4. Amazon automatically predicts which books you may also like based on your current purchase.
  5. Google search engine giving you the best results whenever you type a keyword.
  6. Gmail automatically scanning your emails and throwing some emails in the spam folder

Q: What do the above scenarios have in common?

A: In all the above cases, the computer performs a certain task almost as well as any human is capable of doing!

Let us assume a child is learning to add two single-digit numbers. Initially when the teacher asks her to add, let’s say 2+2, she makes a mistake. So the performance of the child is not 100% accurate. The teacher explains the concept to the child once or twice and after some days the child is successfully able to add a 2 and a 2. In fact, in a few days with a lot of practice examples, she can add ANY two numbers with 100% accuracy. Thus, we can say the child WITH TRAINING has learned the addition of two single-digit numbers.

The same concept applies to a machine/computer as well. Considering the aforementioned six scenarios/tasks, how do we make a machine perform all these tasks? There are software experts who create algorithms and programs that do these tasks perfectly well as a human would do. Do these algorithms succeed at these tasks from the word go? Of course not! They have to be trained and modified repeatedly for several days and this entire process is called MACHINE LEARNING.

The formal definition of machine learning is expressed as follows:

“A machine is said to learn if its performance P at a task T improves with experience E

Coming back to our previous example:

The task at hand T: Adding two single-digit numbers

Performance measure P: How many times was the child able to perform the addition correctly?

Experience E: When the teacher makes the child gain practice by giving her lots of single-digit number pairs to add.

Can you write down the P, E, and T for the six scenarios mentioned earlier?

***

“In God, we trust. All others must bring data”- W. Edwards Deming

AI and ML are not exactly new topics. Researchers have been working on autonomous computing since the 1950s. But AI has reached a tipping point today due to significant advances in computing power. The capacity of an IBM Mainframe computer that occupied the size of your house is now available in your palm — on a smartphone. So you can imagine the computing power of large data centers that are as big as the size of your house, and think about how much data these computers can crunch today and learn from them.

Data is the other part of this equation. With the onset of smartphones and the internet, the volume of data is practically exploding by the day, and by 2025, the total amount of data available globally is expected to be 175 ZB. That’s Zeta Bytes or 1 Trillion Gigabytes! And by this time, the amount of data is expected to double every 12 hours!

So what is data and why is it so important in the context of machine learning?

In practical terms, data is a collection of facts, such as numbers, words, measurements, observations, or just descriptions of things.

In computing, a very simplified structure of data consists of a row and column format, where each row describes one object such as a person, a car, etc., and each column describes some attribute about that object. Consider the example given below which summarizes the Food choices and preferences of college students. Each row represents one student and the columns contain information on food choices, nutrition, preferences, childhood favorites, and other information from college students.

Data Source: https://www.kaggle.com/borapajo/food-choices/data?select=food_coded.csv

The above dataset can help us in learning something such as

How important is the nutrition information for today’s college kids?

Is their taste in food defined by their food preferences when they were children?

Are kids of parents who cook more likely to make better food choices than others?

Are these kids likely to have a different taste compared to others?

Such patterns may not be visible to the human eye at a glance and may take several efforts to discover.

Note that datasets in tabular formats are also called structured data but machine learning can also be performed on complex and unstructured datasets like web pages, images, videos, live streaming data, and all the data generated by the various mobile applications to develop interesting patterns from them.

Let’s take a quick look at how machines can learn given a dataset such as above. Machine learning algorithms can be broadly classified into two categories: Supervised and Unsupervised learning.

Supervised learning: “Learning by example

Source: Corey Chivers

Let us come back to the human learning example. Suppose you are trying to teach a child to identify whether an animal is a cat or a dog. She is shown different photographs in a book with every image labeled with the correct animal name.

With say 100 such images of only dogs and cats, the child will slowly start to identify the animal correctly.

How does it do that? By learning to look at the features/ characteristics of each animal such as height, body structure whiskers, eyes, etc.

Supervised learning is essentially the process of teaching a machine, by feeding it input data as well as correct output data. This input/output pair is usually referred to as “labeled data.” Supervised learning is often used to create machine learning models for two types of problems.

Regression: Predicting the value of Y given the value of X.

Let’s say you are given the temperature of twelve months for the year 2019 and the amount of Ice-cream produced by a popular brand.

Now, given the temperature of January 2020, the machine can predict the amount of ice-cream production for that month.

Regression

Classification

Source: https://medium.com/@k3no/correlation-in-data-6cf145e89146

Source: https://intellipaat.com/blog/tutorial/machine-learning-tutorial/classification-machine-learning/

Classification: Assigning a class/category to every object.

Let us say we have a robot that sorts through all the garbage collected from your locality and the task of the robot is to identify the material and put it in the appropriate bin. This is an example of classification.

In summary:

A Regression task is to predict a numerical value ‘y’ given ‘x’

A classification task comprises assigning every object/row of a table/item to an appropriate class or category.

Unsupervised learning: Extracting clusters/groups from unlabelled data

Let us say you are given information about 100 people such as Age, Gender, Location, Income, Profession, and Hobbies. There are no labels or classes in this type of dataset. Your task is to group them into 3 clusters/groups based only on their similarities to each other.

Once you have made these clusters, you can use this knowledge for a lot of applications. For example, you can recommend a different genre of Movie on Netflix to each group, or sell different types and brands of Mobile phones to different groups, or recommend restaurants on Zomato, and so on. Based on the choices made by some people in a cluster, you can predict the choices made by other people in the same cluster.

Source: Clariba

Testing and Validation:

This is the final step of the machine learning process.

So far we saw how you can train a machine to learn from a dataset, based on an algorithm or model. Ideally, you are now ready to use this model and put it to use in the real world to extrapolate and calculate results beyond the original data set. But how would you determine if the machine’s results are valid and accurate? To be sure, we must perform some testing on the model and verify the accuracy of the results, before deploying it for real-life use cases.

Most of the time in the testing step, a different set of data is given to the model to predict the results. For example, if the original dataset consists of 1000 rows, 700 rows will be used during the training step and the remaining 300 will be used for the testing step. So the accuracy level of the algorithm will tell us how well the machine performs on the data it has not seen so far.

Based on the accuracy results, you may need to re-train your model or iterate a few times until desired accuracy levels are obtained.

That’s pretty much a very simple explanation of how machine learning works. Hope the fundamental concepts of machine learning are now clear to you by now.

Looking to start your child’s Coding journey? Contact us at techmentry.com.

--

--