Machine Learning (ML) has become one of the most widely used technologies in modern data science. From recommending the next video we watch to detecting fraudulent transactions, machine learning helps computers learn patterns from data and use those patterns to make predictions or decisions.
When I first started learning machine learning, I realized that understanding the concept is more important than simply memorizing algorithms.
In this article, we'll break down what machine learning actually is, walk through the three main types with practical examples, and look at how it applies to real business problems.
Machine Learning is a branch of Artificial Intelligence (AI) that allows computers to learn patterns from data and make predictions or decisions without being explicitly programmed for every possible situation.
This is the most common type of machine learning. The model learns from data where the correct answer is already known.
For example:
Age Income Loan Approved
25 30,000 No
35 80,000 Yes
42 100,000 Yes
22 25,000 No
The model learns the relationship between the input variables and the known outcome.
There are two common types of supervised learning:
Regression
Regression is used when we want to predict a numerical value.
Examples include: House prices and Sales revenue. The model learns from the training data and produces numerical predictions.
Classification
Classification is used when the output belongs to a category.
Examples include: Spam / Not Spam, Fraud / Not Fraud
Unlike supervised learning, unsupervised learning works with data where we do not have a predefined target. Here, there's no labeled answer. The model looks for hidden structure or groupings in the data on its own.
One common example is customer segmentation.
Imagine a supermarket has thousands of customers but does not know how to group them. The dataset could contain: Customer, Age, Annual Income, Number of Purchases, Average Spending
A clustering algorithm can identify groups of customers with similar characteristics.
For example:
Group 1 → Low spending customers
Group 2 → Frequent shoppers
Group 3 → High-value customers
The important point is that we did not tell the algorithm which customer belonged to which group. The algorithm discovered the groups based on similarities in the data.
Reinforcement learning is based on the idea of learning through interaction, actions, and rewards.
An agent interacts with an environment and receives feedback based on its actions.
A simplified representation is:
Action
Agent ---------> Environment
↑ |
| |
└------ Reward -----┘
Machine learning is not only something we use in programming exercises. It is already used in many industries
- Banking and Finance
Banks can use machine learning to detect unusual transactions and help identify patterns associated with potentially fraudulent transactions.
For example:
Normal transaction
↓
Customer usually spends KSh 2,000
↓
Suddenly spends KSh 500,000
↓
System identifies unusual activity
- Healthcare
Machine learning can assist with tasks such as:
Medical image analysis
Patient risk prediction
Disease classification
Drug discovery
Hospital resource planning
For example, a model could analyze historical patient information to identify patterns associated with a particular condition.
Machine learning can initially appear complicated because there are many algorithms, mathematical concepts, and technical terms to learn.
However, the basic idea is relatively simple:
Give a machine learning system data, allow it to learn patterns from that data, and use those patterns to make predictions or discover useful information.