Introduction to Machine Learning

Introduction to Machine Learning

Beginner's Guide to AI & Deep Learning | Part 1 of 2

Prerequisites:

• Simple algebra: to work with variables, coefficients, and basic formulas

• Linear equations: to understand linear relationships, weights, and coefficients

1.1 The Need for Machine Learning

Let us start with a simple but powerful notion: machine learning is fundamentally about finding patterns in data. Not rules that a programmer writes by hand, but patterns that a machine discovers on its own. To understand what that means in practice, let us work through a concrete example.

Example 1.1 — Spotting a Pattern Manually

Consider the following table of numbers. Three variables — X1, X2, and Y — are related to each other in some way. Your task is to figure out what that relationship is just by looking at the data.

X1

X2

Y

4

2

8

1

2

5

0

5

10

2

1

4

After examining the table, you may notice that when X1 = 4 and X2 = 2, the output Y = 8. When X1 = 0 and X2 = 5, the output Y = 10. Staring at a few rows, a pattern emerges:

Y = X1 + 2 * X2

More generally, we can write this relationship in a way that highlights its structure:

Y = W1 * X1 + W2 * X2

Here we found that W1 = 1 and W2 = 2. The constants W1 and W2 are called the weights or coefficients of the linear equation. They define how strongly each input variable influences the output Y. This is what we mean by a linear relationship — the output is a weighted sum of the inputs, nothing more.

Example 1.2 — A Real-World Version

Now let us make this practical. Suppose X1 represents the number of bedrooms in a house, X2 represents the total square footage, and Y represents the price of the house. Assume a linear relationship exists between these three quantities.

The relationship might look like one of these:

Price = 1 * Bedrooms + 1 * SquareFootage

Price = 1,00,000 * Bedrooms + 1 * SquareFootage

In these small examples, the pattern was simple enough that we could spot the weights manually with just four rows of data. But now imagine you are given ten thousand rows of house data from a real city — different sizes, different locations, different prices. Finding the right weights by hand would be completely impractical. You would need to try countless combinations, and even then you might miss the true relationship.

This is exactly the problem that machine learning is designed to solve. When the data is too large, too complex, or too high-dimensional for a human to spot the pattern manually, a machine learning algorithm finds the weights automatically — and it can do this for millions of examples.

1.2 Definition of Machine Learning

Machine Learning is the process of automatically finding patterns or relationships in data — like how the price of a house depends on the number of bedrooms and its size — so that a mathematical system can learn the coefficients (weights) that define this relationship, without us having to figure it out manually for thousands or millions of examples.

It helps to break down the two words separately to make the definition feel concrete rather than abstract.

Machine: A mathematical system implemented on a computer that transforms inputs into outputs using adjustable parameters — think of those parameters as the weights W1, W2 we saw in Example 1.1.

Learning: Automatically adjusting the parameters of the machine to improve its performance on a task, using data. The machine sees examples, checks how wrong its current weights are, and updates them to do better next time.

Something worth appreciating here is that machine learning draws on mathematics that is centuries old — algebra, calculus, statistics — most of which is covered in high school or early college. The novelty is not in exotic new math; it is in the idea of using a computer to automate the search for the right parameters across enormous datasets.

The Learning Process: Iteration After Iteration

Think back to Example 1.1. Some people spot the pattern Y = X1 + 2X2 immediately. Others need to scan the rows two or three times. Some people guess Y = X1 + X2 first, notice it is wrong, and correct themselves on the second pass. The human brain iterates through the data, updating its internal "weights" each time it notices a mistake.

A machine learning algorithm does exactly the same thing, just at a far larger scale. It makes one complete pass through the entire dataset (called an epoch), checks how wrong its current weights are using a mathematical error measure, and then adjusts the weights to reduce that error. Then it passes through the data again, and again, and again — sometimes for tens of thousands of iterations — until the weights converge to the values that best capture the true pattern in the data.

One pass through the data may not be enough, nor ten, nor a hundred. Sometimes machine learning models train over tens of thousands of iterations before the weights stabilise. Patience — and a fast computer — are essential.

This loop of checking errors and updating weights is the engine of all machine learning. In the next blog, we will see how this same loop — applied to a network of many interconnected artificial neurons — gives rise to deep learning.

References & Further Reading

Ananthaswamy, Anil. Why Machines Learn. Dutton, 2018.

Bishop, Christopher M. Pattern Recognition and Machine Learning. Springer, 2006.

End of Blog 1 — AI & Deep Learning Series

VT
Written byVishal Taneja
Knowledge Check

Test Your Understanding

Take this interactive quiz to reinforce what you've learned. Earn badges, track your streak, and master the concepts!

  • 5-10 questions per quiz
  • Earn achievement badges
  • Build answer streaks
  • Track your speed