What is Machine Learning

Machine Learning is a way for computers to learn patterns from data and make predictions or decisions without being explicitly programmed.

Examples

• Email Spam or Not Spam
• Past house data Predict house price
• User activity Recommend videos

Where Do We Use It?

• Recommendation systems (Netflix, YouTube)
• Fraud detection
• Image & speech recognition
• Forecasting (weather, sales)Types of Machine Learning

Machine learning systems can learn in different ways, depending on the type of data and feedback available.

• Supervised Learning
• Unsupervised Learning
• Reinforcement Learning
• Semi-supervised Learning

Supervised Learning

Supervised learning is a type of machine learning where:

• Training data includes correct answers (labels)
• The model learns from past examples to predict answers for new data

How it works

Input (X): data given to the model
Output (Y): correct answer

• Train by comparing predictions with known answers

Examples

• Email Spam / Not spam
• House data House price
• Student data Pass / Fail

Regression vs Classification

In supervised learning, we usually solve one of these two problems:

Regression

• Predicts a number
• Output is a continuous value

Examples:

• House features House price
• Height Expected weight / numeric value

Classification

• Predicts a category• Output is a discrete label

Examples:

• Transaction Fraud or Not Fraud
• Email Spam or Not SpamRegression

Regression is used when we want to predict a number.

Example: Height vs Weight

Input (Feature): Height
Output (Label): Weight

Given a person’s height, the model predicts their weight.

Classification

Classification is used when we want to predict a category.

Example: Fraud Detection

Input (Features): transaction details
amount, location, time, device
Output (Label): Fraud or Not Fraud

How to Think About It

• The model learns decision boundaries
• Instead of a line predicting a number, it separates data into groups

Features (X) and Labels (Y)

In supervised learning, every example has:

Features (X): the information we give to the model
Label (Y): the correct answer we want to predict

Example

Features (X):
Size of the house
Location
Number of rooms

Label (Y):
House price

Why Features Matter

• Models learn only from the features you provide
• Better features better predictionsFeature Scaling

Feature scaling is about bringing numerical features to a similar range so models can learn fairly.

Why Scaling Matters

• Features can have very different ranges
• Large numbers can dominate small numbers
• Scaling helps models learn patterns more effectively

Normalization

We scale values to a 0–1 range:
Normalised value = (value − min) / (max − min)

After normalisation:
• 1,000 → 0.0
• 5,000 → 0.44
• 10,000 → 1.0

Employee

Salary

Normalized

A

1,000

0

B

5,000

0.44

C

10,000

1.0

Feature Encoding

Feature encoding is about converting non-numerical data into numbers so models can use it.

Why Encoding Is Needed

• Machine learning models work with numbers only
• Text and categories must be represented numerically

Label Encoding

City

value

Colombo

0

Kandy

1

Galle

2

One-Hot Encoding

Colombo

Kandy    

Galle       

1

0

0

0

1

0

0

0

1

Unsupervised Learning

Unsupervised learning is used when:

• Data has no labels
• We want to discover patterns in the data

Common Goals

• Group similar data points together
• Understand the structure of the data

Example: Customer Segmentation

• Input: customer behaviour data
• Output: groups of similar customers

Clustering

Clustering groups similar data points together.

How It Works

• Each data point has features
• Similar points are placed in the same group

Use Cases

• Customer groups
• Document grouping
• Image grouping

Anomaly Detection

Identifies data points that behave differently from the rest.

How It Works

• Learn what “normal” data looks like
• Flag points that significantly deviate from normal patterns

Use Cases

•Fraud detection (unusual transactions)
•System monitoring
•Security alerts

Reinforcement Learning

Reinforcement learning is about learning what to do through experience.

• An agent takes actions in an environment
• Actions lead to outcomes
• Good outcomes are rewarded
• Bad outcomes are penalised

Goals

• Balance exploration (trying new actions) and exploitation (using what works)
• Maximize long-term reward while balancing exploration vs exploitation.

Examples

• Learning to play chess by playing games
• Learning driving strategies in simulation
• Training a system to make better decisions over time (traffic lights or recommendations)

Time Series Forecasting

Time series problems involve:

• Data collected over time
• Predicting future values from past data

Examples

• Weather forecasting
• Stock prices
• Sales forecasting

Same supervised learning idea, but time order matters.

Deep Learning

Deep learning is a subset of machine learning that uses neural networks.

Why Deep Learning?

• Traditional ML struggles with raw data
• Images, text, and audio are very complex

What It’s Used For

• Image recognition
• Speech recognition
• Large Language Models (LLMs)

Key Takeaways

• Machine learning learns patterns from data
• Supervised learning is the most common in the industry
• Data and features often matter as much as the algorithm
• Different learning types solve different problems
• Focus on the problem + data first, then choose the model

Author: Tharindu Perera is a Tech Lead at CMS with a passion for software architecture, machine learning, and AI.

Author : Admin
Published Date January 26, 2026
Share Post