Source range: ML-UNIT-1-notes.pdf — Paradigms for ML to just before Learning by Rote, and Stages in Machine Learning to just before Top 5 Types of Predictive Models.
A learning paradigm is chosen by the feedback available in the data. A successful ML project then moves from a measurable problem through reliable data, modelling, evaluation, deployment, and monitoring.
1. Learning paradigms
| Paradigm | Training signal | Main goal | Typical tasks/examples |
|---|---|---|---|
| Supervised learning | Labelled examples: each input has a known target | Learn an input-to-output mapping | Classification, regression |
| Unsupervised learning | Unlabelled examples | Discover structure or relationships | Clustering, association rules |
| Semi-supervised learning | A small labelled set plus a large unlabelled set | Use unlabelled data to improve a labelled task | Classifying data when labelling is costly |
| Self-supervised learning | Target is generated from the data itself | Learn useful representations before a later task | Predicting masked words; pre-training LLMs |
| Reinforcement learning | Rewards from interaction with an environment | Learn actions that maximise cumulative reward | Games, robotics, control |
Supervised learning
A supervised-learning dataset contains pairs , where is an input/features and is the correct output/label. The algorithm learns a function
that should predict the right output for unseen inputs.
- Classification: output is a category, such as spam/not spam or disease/no disease.
- Regression: output is a numerical value, such as house price or temperature.
Give a model past houses with their known prices. It learns the relation between area, location, age, and price, then estimates the price of a new house.
Unsupervised learning
Unsupervised learning receives inputs without target labels. It looks for useful patterns, groups, or relationships already present in the data.
- Clustering groups similar examples, such as customers with similar buying behaviour.
- Association rules find co-occurrence patterns, such as customers who buy bread often buying butter.
Discovered groups are not automatically meaningful; they must be checked against the problem context.
Semi-supervised and self-supervised learning
- Semi-supervised learning uses the few examples with labels to define the target task and the many unlabelled examples to reveal the structure of the input distribution.
- Self-supervised learning creates a prediction task from the input itself. For example, hide a word and train the model to predict it from surrounding words. The learned representation can then be fine-tuned for another task.
Semi-supervised learning uses some human-provided labels. Self-supervised learning creates its own training targets from raw data.
Reinforcement learning
An agent interacts with an environment:
The agent is not told the correct action beforehand. It learns through trial and error to maximise total reward.
- Exploration: try an uncertain action to gain information.
- Exploitation: choose the action currently expected to give the best reward.
A game-playing agent makes a move, observes the result and reward, and gradually learns which moves lead to winning.
Distinguish classification and regression with an example. Classification predicts a discrete label, such as spam or not spam. Regression predicts a numerical quantity, such as the selling price of a house. Both use labelled examples in supervised learning.
Explain supervised and unsupervised learning with examples. Supervised learning learns from input–target pairs, such as emails labelled spam or not spam. Unsupervised learning finds structure without supplied target labels, such as grouping customers into clusters by purchasing behaviour.
2. The seven stages of machine learning
The seven-stage framework organises an ML project from business need to a running system:
- Problem definition
- Data collection
- Data preparation
- Data visualisation
- ML modelling
- Feature engineering
- Model deployment
Three project phases
| Phase | Included work | Purpose |
|---|---|---|
| Business value | Problem definition | Establish the customer/business benefit, success measure, and feasibility. |
| Proof of Concept (POC) | Data collection through feature engineering | Test whether useful, measurable model performance is achievable. |
| Production | Deployment and iteration | Integrate the model into a real process, scale it, and monitor it. |
1. Problem definition
Define exactly what must be predicted or decided and why it matters.
- State the business goal, target variable, users, constraints, and a measurable success metric.
- Check whether a traditional deterministic rule already solves the problem.
- Determine whether the problem is probabilistic and whether the required data exists.
- Identify the cost of different errors; for example, a false medical negative may be much more costly than a false positive.
2. Data collection
Collect relevant, representative data from suitable sources. Ask:
- What data is needed?
- Where is it available?
- How will it be obtained, stored, secured, and accessed?
Possible sources include internal user/usage data, interviews, surveys, experiments, observations, sensors, APIs, public datasets, institutional databases, simulations, and legally permitted web scraping.
3. Data preparation
Data preparation is often the most time-consuming stage. It explores, cleans, validates, conditions, and transforms raw data before modelling.
Typical work:
- remove duplicates and invalid records;
- correct inconsistent formats, units, and labels;
- handle missing values and outliers;
- filter, aggregate, reconcile, and transform data;
- split data into training, validation, and test sets without leakage.
Do not use information unavailable at prediction time, and do not fit preprocessing on validation/test data. Leakage can make evaluation look excellent while the deployed model fails.
4. Data visualisation and exploratory data analysis (EDA)
Visualisation helps identify distributions, trends, outliers, relationships, and data-quality problems before modelling.
Useful plots include bar charts, histograms, box plots, heat maps, area charts, scatter/bubble plots, network diagrams, and word clouds.
5. ML modelling
Train candidate algorithms to find useful patterns in the prepared data. Common ML tasks are:
- regression — predict a number;
- classification — predict a class;
- forecasting — predict future values;
- clustering — group similar examples.
The modelling stage applies mathematical, computational, and domain knowledge. Its output must be compared with a baseline and evaluated on held-out data, not only on the training data.
6. Feature engineering
Feature engineering improves the representation given to a model. It is iterative with modelling: test a representation, evaluate it, and refine it when justified.
Good features should be unambiguous, capture relevant linear/non-linear relationships, preserve the meaning of the input, and include useful context.
7. Model deployment and monitoring
Deployment makes a trained model’s predictions available to users or another system.
Before deployment, check robustness, compatibility, latency, scalability, security, and failure behaviour. After deployment:
- monitor input-data changes and model errors;
- compare live performance with the expected validation/test performance;
- retrain or revise the model when evidence shows that the data distribution or requirements have changed.
Define → collect → prepare → explore → model → engineer features → deploy and monitor.
3. Data acquisition (DAQ)
Data acquisition is the process of collecting and storing data from one or more sources for analysis and ML training. Its objective is a complete, representative, high-quality dataset that captures relevant variation in the real world.
DAQ system pipeline
| Component | Role |
|---|---|
| Sensor | Converts a physical quantity such as temperature, pressure, voltage, or vibration into an electrical signal. |
| Signal conditioner | Makes the raw signal reliable through amplification, filtering, and/or isolation. |
| Analogue-to-digital converter (ADC) | Converts a continuous analogue signal into discrete digital values. |
| Data logger / processing unit | Samples, buffers, timestamps, transfers, and manages incoming data. |
| Storage | Retains the acquired data for real-time monitoring or later analysis. |
DAQ can measure temperature, pressure, voltage, current, strain, shock/vibration, rotational speed, angle, distance, displacement, and weight.
Why data acquisition matters
- supports accurate measurement and long-term trend analysis;
- enables real-time monitoring, faster fault diagnosis, and preventive maintenance;
- reduces manual collection and avoidable data redundancy;
- supplies the raw evidence on which an ML model learns.
Data quality depends on factors such as volume, velocity, variety, calibration, sampling rate, units, missing intervals, noise, and representativeness.
A vibration sensor sampled too slowly may miss a rapid fault pattern. Sampling faster can capture the pattern, but it cannot repair a badly calibrated sensor.
4. Feature engineering
A feature (variable/attribute) is a measurable property of one example used as model input. For housing-price prediction, area, location, bedroom count, and age are features.
Feature engineering transforms raw information into features that make meaningful patterns easier for a model to learn.
Five main processes
| Process | Meaning | Examples |
|---|---|---|
| Feature creation | Create a new feature using domain knowledge or observed patterns. | price per square foot; interaction of two variables |
| Feature transformation | Change a feature into a more suitable representation. | log transform; normalisation; encoding |
| Feature extraction | Derive compact/relevant features from rich input. | PCA; aggregate mean/sum/count; text vectors |
| Feature selection | Keep a useful subset of existing features. | filter, wrapper, embedded methods |
| Feature scaling | Put numerical features on comparable scales. | min-max, standard, robust scaling |
Creation, transformation, and extraction
- Creation: domain-specific, data-driven, or synthetic combinations can add predictive information.
- Transformation: converts values to a form the algorithm handles better. Examples: logarithmic/square-root transforms, categorical encoding, and normalisation.
- Extraction: creates a new informative representation, often while reducing dimensionality. Examples: PCA, aggregates, interactions, and derived text features.
Feature selection
Feature selection reduces noise, computation, overfitting risk, and complexity.
| Method | How it selects |
|---|---|
| Filter | Scores each feature statistically, for example with correlation or mutual information. |
| Wrapper | Trains/evaluates models on alternative feature subsets. |
| Embedded | Selection happens as part of fitting the algorithm. |
Feature scaling
| Method | Formula / idea | Use |
|---|---|---|
| Min-max scaling | Maps training values to a chosen range, commonly . | |
| Standard scaling | Produces zero mean and unit standard deviation using training statistics. | |
| Robust scaling | Scale using median and interquartile range | Less sensitive to outliers. |
Apply fitted scalers and selectors from the training set to validation/test/live data. Fitting them on all data leaks held-out information.
Common engineering techniques
- One-hot encoding: represent each nominal category with a binary indicator. Avoids inventing an order such as red=1, blue=2, green=3.
- Binning: convert a continuous value into intervals, such as age groups. It can expose threshold effects but loses within-bin detail.
- Feature splitting: break one compound feature into useful parts, such as extracting day, month, and hour from a timestamp.
- Text preprocessing: tokenisation, selective stop-word removal, stemming/lemmatisation, and vectorisation.
Clean data → transform it → extract/create features → select useful ones → evaluate → iterate.
Explain the significance of feature engineering with an example. What is dimensionality reduction? Feature engineering converts raw information into variables that expose useful structure. For house prices, calculate property age from the construction year; fit any learned transformation using training data only. Dimensionality reduction maps features into fewer dimensions, for example PCA projections, to reduce redundancy or storage and aid visualization. It can also discard useful information.
5. Data representation
ML systems represent data numerically.
| Structure | Dimensions | Example |
|---|---|---|
| Scalar | 0-D | one temperature reading, |
| Vector | 1-D | seven daily temperatures, |
| Matrix | 2-D | a grayscale image or table of examples × features |
| Tensor | 3-D or higher | an RGB image of shape height × width × 3; a batch of images |
Representation affects what patterns a model can learn. The feature order, units, transformations, and meaning used at training must be preserved at inference time.
Ensemble learning
An ensemble combines several models. Bagging fits models on bootstrap samples and aggregates their outputs, often reducing variance; a random forest additionally samples candidate features at splits. Boosting fits models sequentially so later models focus on errors or loss gradients of the current ensemble. Improvement is not automatic: diversity, individual model quality and the chosen aggregation all matter.
Describe two ensemble-learning techniques. Bagging trains base learners on resampled datasets and averages or votes; boosting trains a sequence of learners to improve the current ensemble’s errors. Both combine models, but their training procedures differ.
6. Model selection
Model selection chooses the algorithm, architecture, and hyperparameters that best solve the task while generalising to new data.
The aim is not the smallest training error. An overly simple model can underfit; an overly complex model can overfit and fail on unseen data.
Selection process
- Formulate the task and choose suitable evaluation metrics.
- Select reasonable candidate models.
- Train candidates on training data.
- Evaluate on validation data or through cross-validation.
- Compare performance, interpretability, data handling, latency, and resource cost.
- Tune hyperparameters.
- Select the final model and evaluate it once on the held-out test set.
Important selection factors
- problem complexity and type of relationship;
- data size, quality, noise, missing values, and class imbalance;
- model assumptions and ability to generalise;
- interpretability and domain requirements;
- training/inference time, memory, and deployment constraints;
- regularisation, ensemble benefits, and domain expertise.
Common techniques
| Technique | Purpose |
|---|---|
| Train-test split | Fast evaluation using separate training and test subsets. |
| Cross-validation | Repeats train/validation splits across folds for a more stable estimate. |
| Grid search | Tests every combination in a fixed hyperparameter grid. |
| Random search | Samples configurations; often more efficient in large search spaces. |
| Bayesian optimisation | Uses earlier trial results to choose promising configurations. |
| Model averaging / ensembles | Combines predictions to reduce instability or improve accuracy. |
| AIC/BIC | Likelihood-based criteria that trade goodness of fit against complexity. |
7. Model evaluation
Model evaluation measures strengths, weaknesses, and expected performance on new data. It is essential for reliable deployment.
| Fit | Meaning |
|---|---|
| Overfitting | Learns training data too closely; training performance is good but unseen-data performance is poor. |
| Underfitting | Is too simple to capture the underlying pattern; both training and test performance are poor. |
| Right fit | Has low error on both training and unseen test data. |
Metric families
| Task | Example metrics |
|---|---|
| Classification | accuracy, precision, recall, F1-score, ROC-AUC |
| Regression | MSE, MAE, |
| Ranking | MRR, DCG, NDCG |
| Clustering/statistical work | correlation and task-specific scores |
| Computer vision | PSNR, SSIM, IoU |
| NLP | perplexity, BLEU |
| Generative/deep learning | Inception Score, FID |
Confusion matrix for binary classification
| Actual positive | Actual negative | |
|---|---|---|
| Predicted positive | True positive (TP) | False positive (FP) |
| Predicted negative | False negative (FN) | True negative (TN) |
- Accuracy is the overall proportion of correct predictions; it can be misleading for highly imbalanced classes.
- Precision asks: among predicted positives, how many were really positive?
- Recall asks: among actual positives, how many did the model find?
- F1-score balances precision and recall.
- ROC curve plots true-positive rate against false-positive rate across thresholds; AUC summarises discrimination across those thresholds.
What are overfitting and underfitting? An overfit model learns patterns including noise specific to training data and generalizes poorly. An underfit model is too limited or insufficiently trained to capture useful structure, giving poor training and validation performance. Compare both learning curves, use a representative validation set, and consider regularization or a more expressive model as appropriate.
Design a classifier to identify bloggers who post at least 10% fake blogs; discuss features, extraction, storage, model and metrics. Useful features include the fraction of a blogger’s reviewed posts judged false, text embeddings and source credibility indicators; justify each by its relationship to the task. Extract language-aware text features and aggregate by blogger, then store a numeric vector per blogger. A supervised classifier requires reliable blogger labels. Split by blogger and time before fitting preprocessing to avoid leakage; train a model, tune on validation data and evaluate once on a held-out set. Report precision, recall, F1 and the confusion matrix, particularly if classes are imbalanced. Avoid assuming a feature like the exact proportion of false posts is available at prediction time unless it can actually be measured without knowing the answer.
8. Predictive modelling
Predictive modelling uses historical and current data to forecast likely future or unknown outcomes. It is used for tasks such as customer purchase prediction, credit-risk assessment, revenue forecasting, and TV-rating estimation.
Key points:
- A predictive model learns assumptions from past/current data and applies them to new cases.
- It is not a one-time artefact: validate, monitor, and revise it when incoming data or the underlying process changes.
- Many practical predictions run in real time, such as an online credit decision; more complex scientific predictions may take longer.
- Prediction quality depends on valid data, appropriate features, a suitable evaluation metric, and performance on unseen data.
Choose the paradigm from the feedback. Build the project through the seven stages. Select and evaluate for generalisation, then deploy with the same preprocessing and continuous monitoring.






