Supervised Learning in Data Analytics
Supervised Learning in Data Analytics
Supervised learning refers to machine learning techniques where models are trained using
labelled data. The goal is to learn a mapping from inputs (features) to outputs (labels) that
can generalise to unseen data. In data analytics, supervised learning is widely used for
prediction, classification, and decision support.
Supervised learning in big data analytics involves training models on massive, high-volume
and high-variety labelled datasets in order to make accurate predictions or classifications
while addressing scalability, data quality, and computational challenges.
What is Supervised Learning?
Supervised learning uses a dataset containing input–output pairs. During training, the model
compares its predictions with the true labels and adjusts itself to minimise error. This process
relies heavily on the quality of labelled data.
Supervised vs Unsupervised Learning
• Supervised learning: Uses labelled data (e.g. spam detection, house price prediction)
• Unsupervised learning: Uses unlabelled data (e.g. clustering, dimensionality
reduction)
Supervised learning focuses on prediction accuracy, while unsupervised learning focuses on
discovering structure.
Types of Supervised Learning
Two main types:
• Regression: Predicts continuous values
Predicts continuous values
Examples:
• Demand forecasting
• Price prediction
• Energy consumption estimation
• Classification: Predicts discrete class labels
Predicts categorical outcomes
Examples:
• Fraud vs non-fraud transactions
• Spam vs non-spam emails
• Customer churn (yes/no)
Regression Problems
Regression models predict numerical values.
Examples:
• Predicting house prices
• Estimating energy consumption
• Forecasting sales
Classification Problems
Classification models assign inputs to predefined categories.
Examples:
• Email spam detection
• Disease diagnosis
• Credit approval
Common Supervised Learning Algorithms
Widely used algorithms include:
• Linear Regression
• Logistic Regression
• k-Nearest Neighbours (k-NN)
• Decision Trees
• Support Vector Machines (SVM)
• Naïve Bayes
• Neural Networks
Linear Regression
Linear regression models the relationship between variables using a straight line. It assumes a
linear relationship and is simple, interpretable, and computationally efficient.
Logistic Regression
Despite its name, logistic regression is used for classification. It estimates the probability of
class membership using a sigmoid function.
k-Nearest Neighbours (k-NN)
k-NN classifies data points based on the labels of the closest neighbours. It is simple but
computationally expensive for large datasets and sensitive to feature scaling.
Decision Trees
Decision trees split data based on feature values to make predictions. They are intuitive and
easy to interpret but can overfit if not controlled.
Support Vector Machines (SVM)
SVMs aim to find an optimal decision boundary (hyperplane) that maximises the margin
between classes. They perform well in high-dimensional spaces.
Model Training and Testing
Datasets are typically split into:
• Training set: Used to learn model parameters
• Testing set: Used to evaluate performance on unseen data
Overfitting and Underfitting
• Overfitting: Model learns noise instead of patterns
• Underfitting: Model is too simple to capture relationships
Overfitting:
• The model learns the training data too well, including noise and random
fluctuations.
• Performs excellent on training data but poor on new/unseen data.
• Usually happens with very complex models or too many features.
• Solution: simplify the model, use regularization, or get more data.
Underfitting:
• The model is too simple to capture the underlying patterns in the data.
• Performs poorly on both training and test data.
• Usually happens with too simple models or insufficient features.
• Solution: increase model complexity, add features, or reduce regularization.
Balancing bias and variance is crucial.
Evaluation Metrics (Classification)
Common metrics:
• Accuracy
• Precision
• Recall
• F1-score
• Confusion matrix
Metric choice depends on the problem context.
Evaluation Metrics (Regression)
Common metrics:
• Mean Absolute Error (MAE)
• Mean Squared Error (MSE)
• Root Mean Squared Error (RMSE)
• R² score
Feature Engineering
Feature engineering involves selecting, transforming, and creating features to improve model
performance. Good features often matter more than the choice of algorithm.
Scenario: You have a dataset of customers with a column Date_of_Birth and want to
predict if they will buy a product.
Raw feature:
• Date_of_Birth → e.g., 1990-05-15
Engineered features:
1. Age → 2026 - 1990 = 36
2. Age group → 30-40
3. Birth month → May (maybe relevant for seasonal trends)
Another common example:
Raw data: Purchase_amount
• You can create a new feature: High_spender = Purchase_amount > 1000
(Yes/No)
These new features often help the model learn patterns more effectively.
Applications in Data Analytics
Supervised learning is used in:
• Finance (fraud detection)
• Healthcare (diagnosis)
• Marketing (customer segmentation)
• Education (student performance prediction)
Limitations of Supervised Learning
• Requires large labelled datasets
• Labels may be noisy or biased
• Models may not generalise well
Summary
Supervised learning is a core component of AI-driven data analytics. Understanding problem
types, algorithms, evaluation metrics, and ethical considerations is key to building reliable
and responsible systems.