November 2024 — Solved
Computational Methods for Data Science
End-Semester Examination, First Semester PG Diploma in Data Science and Analytics (2024 Admission).
Part A — Short Essay
Answer any five questions. Each question carries 2 marks. (5 × 2 = 10 Marks)
Q1. Write any two applications of Fourier transform.
- Audio / signal processing — decomposing a sound signal into its frequency components for equalisation, noise filtering, and compression (MP3 uses a related transform).
- Image processing — frequency-domain filtering for denoising, edge detection, and JPEG compression (which is built on the related DCT).
(Other valid uses: solving differential equations, MRI reconstruction, radar, telecommunications, spectroscopy.)
Q2. Explain the Strong Law of Large Numbers.
The Strong Law of Large Numbers (SLLN) states that if are i.i.d. random variables with mean , then the sample mean converges almost surely to :
This is the theoretical justification for estimating means from large samples — and underpins Monte Carlo simulation. "Strong" because the convergence holds with probability 1 (almost-sure), unlike the Weak Law which is convergence in probability.
Q3. What is the role of image acquisition in the image processing pipeline?
Image acquisition is the first stage — converting a physical scene into a digital image via a sensor (camera, scanner, MRI coil, satellite imager). The sensor performs sampling (spatial discretisation, governed by Nyquist) and quantisation (intensity discretisation). The quality of acquisition (resolution, noise, exposure, lens distortion) sets a hard upper bound on every downstream step (denoising, enhancement, segmentation, recognition).
Q4. How are eigenvectors related to principal components?
In Principal Component Analysis (PCA), the principal components are the eigenvectors of the covariance matrix of the centred data. They are the orthogonal directions of maximum variance. The corresponding eigenvalues equal the variance along each direction. The first PC = top eigenvector, second PC = next eigenvector, and so on.
Q5. List the three main steps involved in image processing.
- Image acquisition — capture and digitise (sensor → pixels).
- Image processing / enhancement — denoising, sharpening, restoration, transformation, segmentation, feature extraction.
- Image analysis / interpretation — classification, recognition, decision (e.g., is there a tumour in this MRI?).
Q6. Explain Type I and Type II error in statistical hypothesis testing.
- Type I error (, false positive) — rejecting a true null hypothesis . Probability = significance level (typically 0.05).
- Type II error (, false negative) — failing to reject a false null hypothesis. The power of a test is .
There is an unavoidable trade-off: lowering raises (and vice-versa) for a fixed sample size.
Q7. What mathematical theory forms the foundation of the Fourier Series?
The Fourier Series is grounded in the theory of orthogonal function expansions in a Hilbert space, specifically inner product spaces. The sines and cosines form a complete orthonormal basis on , so any (square-integrable) periodic function can be uniquely written as a linear combination — exactly as a vector decomposes onto an orthonormal basis.
Part B — Long Essay
Answer any two questions. Each question carries 20 marks. (2 × 20 = 40 Marks)
Q8.
(a) Compare the Gaussian filter and Mean filter for noise reduction. Discuss their effects on image edges and noise suppression. (10 marks)
Both are linear spatial filters that smooth images by convolving with a kernel. They are widely used as the first step in image-processing pipelines.
Mean (Box / Average) filter.
Each output pixel is the unweighted average of its neighbourhood:
3×3 example kernel:
Gaussian filter.
Weighted average using a 2-D Gaussian kernel, so pixels closer to the centre contribute more:
Larger → wider, smoother blur. The kernel is separable: a 2D Gaussian convolution equals two 1D convolutions — fast.
Comparison.
| Aspect | Mean filter | Gaussian filter |
|---|---|---|
| Kernel weights | Uniform | Centre-weighted (bell-shape) |
| Frequency response | Sinc-shaped — has side-lobes, leaks high frequencies | Gaussian — monotonically decreasing, no ringing |
| Noise suppression | Good for additive Gaussian noise — but rough | Better, smoother suppression of Gaussian noise |
| Edge preservation | Poor — blurs edges hard; produces blocky artefacts | Smoother blur but still blurs edges |
| Artefacts | Ringing, halos near edges | Soft halos; minimal ringing |
| Smoothness vs detail | Strong smoothing, loses fine detail | Tunable via — better trade-off |
| Computational cost | Cheapest | Slightly higher (separable kernel mitigates) |
| Salt-and-pepper noise | Fails — keeps spikes | Fails — use a median filter instead |
| Theoretical link | Special case of weighted average | Maximum-entropy smoother |
| Typical use | Quick smoothing, downsampling preview | Pre-processing for edge detection (Canny uses Gaussian), feature extraction |
Effect on edges. Both filters are isotropic and linear — they don't know where the edges are. Both blur edges, but a Gaussian blurs more gracefully (no ringing), giving a softer result. For edge-preserving denoising one must instead use bilateral, median, non-local means, or modern BM3D / deep-learning denoisers.
Effect on noise. For additive Gaussian noise, the Gaussian filter is the optimal linear smoother (Wiener-filter limit) — its frequency response matches the noise's spectral assumptions and avoids the side-lobes of a box filter. Box filtering is acceptable for casual smoothing but generally inferior.
(b) Benefits of digital image processing for improving image quality and automating tasks. (10 marks)
Image-quality improvements.
- Noise reduction — Gaussian, median, non-local means and modern deep denoisers remove sensor noise, increasing perceived sharpness.
- Contrast enhancement — histogram equalisation, CLAHE, gamma correction reveal detail hidden in shadows / highlights.
- Sharpening — unsharp masking, Laplacian-based enhancement strengthen edges and structure.
- Restoration — deblurring (motion / focus), inpainting of missing regions, dust / scratch removal in archival images.
- White-balance and colour correction — restore natural colours under arbitrary illumination.
- Super-resolution — single-image and learning-based methods reconstruct higher-resolution images.
- Geometric correction — perspective rectification, lens-distortion removal.
- Compression — JPEG/JPEG-2000/HEIF reduce file size with minimal perceptible loss.
Task automation.
- Object detection and classification — autonomous driving, surveillance, defect detection on factory lines.
- Medical diagnosis — automatic detection of tumours in CT/MRI, diabetic retinopathy screening, X-ray triage.
- Optical Character Recognition (OCR) — automated form processing, postal sorting, document digitisation.
- Face recognition — biometric authentication, unlocking phones, airport gates.
- Satellite and remote sensing — land-use classification, deforestation monitoring, crop-yield estimation.
- Agriculture — disease detection on leaves, fruit-ripeness sorting, weed identification.
- Industrial inspection — robotic quality control on production lines.
- Sports and entertainment — Hawk-Eye in tennis/cricket, motion capture, AR filters.
- Security and forensics — license-plate recognition, video analytics, fingerprint matching.
- Augmented reality — real-time scene understanding for AR overlays.
Strategic benefits.
- Speed and scale. A model can process millions of images / hour — impossible manually.
- Consistency. No fatigue, no inter-rater variability.
- Cost reduction. Automates labour-intensive tasks (medical screening, quality control).
- New capabilities. Sees patterns humans miss (subtle pixel-level cancer features).
- Data-driven decisions. Quantifies what was previously subjective ("looks like a defect" → 0.87 probability).
- 24/7 operation. Round-the-clock surveillance, monitoring, screening.
Q9.
(a) Process of computing the Singular Value Decomposition (SVD) of a matrix, including the steps to calculate eigenvalues and eigenvectors. (10 marks)
Statement. For any real matrix there exist orthogonal , and a diagonal (with non-negative entries ) such that
The are the singular values, columns of are left singular vectors, columns of are right singular vectors.
Computational process.
Step 1 — Form . This is , symmetric, positive semi-definite.
Step 2 — Eigendecompose .
Solve to obtain eigenvalues and corresponding orthonormal eigenvectors via .
The right singular vectors are these ; assemble into .
Step 3 — Singular values.
Place them on the diagonal of , descending.
Step 4 — Left singular vectors.
For each non-zero :
Verify and they are orthogonal. Stack into (where = rank of ). Extend to a full orthonormal basis if needed.
Step 5 — Verify. Reconstruct and check.
Worked example. .
Step 1. .
Step 2. Eigenvalues: .
Eigenvectors: for : .
For : .
Step 3. Singular values .
Step 4. Left singular vectors: .
.
Result. with .
Practical algorithms. Direct eigendecomposition is unstable for large matrices. Production SVD uses Householder bidiagonalisation + QR iterations (Golub–Kahan), Jacobi rotations, or Lanczos/randomised SVD for very large sparse matrices.
(b) Step-by-step process of Principal Component Analysis (PCA), including the mathematical rationale for each step. (10 marks)
Goal. Find a lower-dimensional orthogonal basis that preserves maximum variance of the data — equivalently, that minimises reconstruction error (Eckart–Young).
Step 1 — Centre the data. Rationale. PCA finds directions through the origin; centring places the data's centre of mass at the origin so the first PC truly captures variance, not the offset of the mean.
Step 2 — Standardise (optional). Divide by std of each feature. Rationale. Variance is scale-sensitive: a feature in millimetres will dwarf one in kilograms unless both are standardised. Skip only if features share units.
Step 3 — Compute covariance matrix. is symmetric, positive semi-definite. tells how features and co-vary. Rationale. PCA seeks directions of maximum variance — variance is encoded in .
Step 4 — Eigendecompose .
Solve . Obtain eigenpairs .
- Eigenvectors are orthonormal directions in feature space.
- Eigenvalues are the variance along .
Rationale. The direction that maximises subject to is, by the Rayleigh quotient, the eigenvector of with the largest eigenvalue. The next-best orthogonal direction is the second eigenvector, and so on.
Step 5 — Sort and select top- components.
Sort and choose top — typically to keep, say, 95% cumulative variance: Rationale. Most variance is concentrated in a few directions; the rest are noise.
Step 6 — Project.
Form and project: Rationale. is the data in the reduced-dim PCA basis. Each row is the new representation of .
Step 7 — Reconstruct or analyse.
Reconstruct: (back to original space). The reconstruction error is — by Eckart–Young this is the minimum possible for any rank- approximation.
Equivalence with SVD. PCA can be done directly via SVD of the centred data matrix : the principal components are columns of , and the singular values squared (over ) are the variances. SVD is numerically preferable to forming explicitly.
Applications.
- Dimensionality reduction for ML (faster training, less overfitting).
- Visualisation in 2D / 3D.
- Denoising by reconstructing from top components.
- Compression — Eigenfaces, hyperspectral imaging.
Caveats.
- PCA is linear — for non-linear manifolds use Kernel PCA, t-SNE, UMAP, autoencoders.
- Principal components are not interpretable as original features.
- Sensitive to scaling and outliers.
Q10.
(a) Process of image recognition and its significance in computer vision, with examples. (10 marks)
Definition. Image recognition is the task of identifying what is in an image — assigning class labels to entire images, regions, or pixels. It is a central problem in computer vision.
Typical pipeline.
1. Image acquisition. Camera, scanner, MRI — produces raw pixel array.
2. Pre-processing.
- Resize, crop, normalise pixel intensities to .
- Denoise (Gaussian / median).
- Colour normalisation, white-balance.
- Augment (rotate, flip, jitter) during training.
3. Feature extraction. Two paradigms:
- Hand-crafted features (classical): SIFT, SURF, HOG, LBP, Haar, colour histograms.
- Learned features (deep learning): Convolutional Neural Networks (CNNs) learn hierarchical features automatically — early layers detect edges, mid layers detect parts, deep layers detect object concepts.
4. Classification / decision.
- Classical: SVM, Random Forest, KNN on the extracted features.
- Deep: softmax head on top of a CNN backbone (ResNet, EfficientNet, ViT).
5. Post-processing. Non-max suppression (object detection), morphological cleanup, threshold tuning.
6. Output. Label + confidence; or bounding boxes; or pixel-wise segmentation mask depending on task.
Categories of recognition tasks.
| Task | Output |
|---|---|
| Classification | Whole-image label (e.g., "cat") |
| Localisation | Label + bounding box |
| Object detection | Multiple labels + boxes (YOLO, Faster R-CNN) |
| Semantic segmentation | Class label per pixel (U-Net, DeepLab) |
| Instance segmentation | Per-pixel labels with instance IDs (Mask R-CNN) |
| Face recognition | Identity verification or identification |
| OCR | Text strings from images |
Significance in computer vision.
- Foundation of modern AI applications — autonomous driving, medical imaging, robotics, AR/VR, surveillance.
- Replaces or augments human vision for high-volume / dangerous / detailed tasks.
- Enables new capabilities — recognises microscopic patterns, satellite features, defect types invisible to humans.
- Drives ImageNet-style breakthroughs that propelled deep learning from 2012 onward (AlexNet → ResNet → ViT).
Examples.
-
Medical imaging. Detect diabetic retinopathy from retinal fundus images (Google's deep-learning model achieved cardiologist-level accuracy). CheXNet detects 14 chest conditions from X-rays.
-
Autonomous vehicles. Tesla, Waymo recognise pedestrians, traffic lights, lane markings in real time using CNNs.
-
Face recognition. Apple Face ID, airport e-gates, photo-tagging in Google Photos.
-
OCR / Document AI. Bank cheque scanning, invoice processing, Google Lens translation.
-
Agriculture. Detect crop disease from leaf photos; classify ripeness; estimate yield from drone imagery.
-
Industrial QC. Detect manufacturing defects on assembly lines (cracks, scratches, missing components).
-
Wildlife conservation. Camera-trap image analysis to track endangered species automatically.
-
Retail. Visual search ("find this product"), checkout-free stores (Amazon Go).
(b) Concept of compressed sensing and its key principles in signal reconstruction. (10 marks)
Motivation. Classical sampling theory (Nyquist–Shannon) demands sampling at at least twice the highest frequency. For modern signals (MRI, hyperspectral imaging, radar), Nyquist sampling is expensive in time and storage. Compressed Sensing (CS) — pioneered by Candès, Romberg, Tao and Donoho (2004–06) — shows we can recover a signal from far fewer measurements than Nyquist if the signal is sparse in some basis.
Setup. Let be the signal we want to recover. We take linear measurements:
The matrix is called the sensing / measurement matrix. Recovering from is underdetermined — infinitely many solutions. CS gives us conditions under which the correct can still be uniquely recovered.
Key principles.
1. Sparsity. The signal is -sparse in some basis — i.e., where has at most non-zero entries. Natural images are sparse in wavelets; audio in DCT; communication signals in Fourier basis.
2. Incoherent measurements. The sensing matrix must be incoherent with the sparsity basis — meaning rows of are "spread out" in the basis . Random Gaussian / Bernoulli / random Fourier matrices are highly incoherent with almost any fixed basis.
3. Restricted Isometry Property (RIP). For some , for all -sparse . RIP guarantees that distinct sparse signals produce distinct measurements — making them recoverable.
4. minimisation reconstruction. Given measurements , recover by solving the convex programme
The norm is a convex proxy for the (non-convex) count of non-zeros, and Candès–Tao showed that with sufficient incoherent measurements (), recovery exactly equals recovery.
5. Stability and robustness. Realistic measurements have noise . The variant (or its Lagrangian Lasso form) recovers with error bounded by the noise level.
Algorithms. Basis Pursuit / Lasso (convex optimisation), Orthogonal Matching Pursuit (greedy), Iterative Hard / Soft Thresholding, approximate message passing.
Why it matters — applications.
- MRI — measure far fewer Fourier samples; reconstruct via CS. Reduces scan time from 30 min to a few minutes, important for paediatric and cardiac MRI.
- Single-pixel camera (Rice Univ.) — uses random masks to capture an image with one photodetector and CS reconstruction.
- Compressed sensing radar — fewer pulses, sparser signal recovery.
- Hyperspectral imaging, seismic data, networked sensors — wherever Nyquist sampling is prohibitive.
- Machine learning — sparse recovery / Lasso / dictionary learning all rest on the same principles.
Significance. Compressed sensing rewrote our understanding of sampling: sparsity beats bandwidth. Whenever signals have few effective degrees of freedom in some basis, we can sense them with proportionally few measurements — a paradigm now embedded in MRI scanners, cameras, communication systems, and machine-learning regularisers.
Q11.
(a) Fourier Series, Fourier Transform, Fast Fourier Transform (FFT), Time-Frequency Analysis — differences and applications. (10 marks)
A family of related tools for decomposing signals into frequency components, each suited to different signal types and computational regimes.
1. Fourier Series (FS).
Applies to periodic signals. Any sufficiently nice periodic signal of period can be written as
Outputs a discrete spectrum at integer multiples of .
Applications. Analysing musical notes, AC power waveforms, periodic vibrations in mechanical systems, solving heat / wave equations on bounded domains.
2. Fourier Transform (FT).
Generalises FS to non-periodic, continuous signals over :
Outputs a continuous spectrum .
Applications. Signal-processing theory, telecommunications, image processing, optics, quantum mechanics, solving differential equations.
3. Discrete & Fast Fourier Transform (DFT / FFT).
Real-world signals are sampled. The DFT of is
Naive DFT costs . The FFT (Cooley–Tukey 1965) computes it in — the algorithmic breakthrough that made digital signal processing practical.
Applications. MP3 / JPEG / video compression (related transforms), spectrum analysers, OFDM in 4G/5G, radar, MRI image reconstruction, real-time audio effects, convolutions via the frequency domain.
4. Time-Frequency Analysis.
The standard FT tells us what frequencies are present but not when they occur — it averages over all time. For non-stationary signals (speech, music, EEG), we need both. Approaches:
-
Short-Time Fourier Transform (STFT) — slide a short window across the signal, take FT in each window: Produces a spectrogram (frequency vs time vs amplitude). Trade-off: a short window gives good time resolution but poor frequency resolution and vice versa (Heisenberg uncertainty principle).
-
Wavelet transform — uses scalable wavelets instead of a fixed window, giving good time resolution at high frequency and good frequency resolution at low frequency. Multi-resolution analysis.
-
Wigner–Ville distribution — joint time-frequency distribution; high resolution but cross-term artefacts.
Applications. Speech recognition, music analysis, biomedical signals (EEG, ECG), seismic data, sonar / radar, fault detection in rotating machinery.
Side-by-side comparison.
| Tool | Signal type | Output | Time/freq resolution | Complexity | Best use |
|---|---|---|---|---|---|
| Fourier Series | Periodic, continuous | Discrete spectrum | No time info | – | Periodic signals |
| Fourier Transform | Non-periodic, continuous | Continuous spectrum | No time info | – | Theory, continuous signals |
| DFT / FFT | Discrete, finite | Discrete spectrum | No time info | Digital signals, real-time DSP | |
| STFT / Wavelets | Discrete or continuous | Time–frequency map | Time AND freq | per frame | Non-stationary, transient signals |
(b) What are random variables and their types? Give any four types of random variables with their probability distribution functions. (10 marks)
Random variable (RV). A random variable is a function that assigns a real number to each outcome of a random experiment. It is the bridge between abstract sample spaces and numerical analysis — it lets us talk about probabilities of numbers () rather than probabilities of outcomes.
Distribution function. For any RV, the Cumulative Distribution Function (CDF) exists; it is non-decreasing, right-continuous, with and .
Types of random variables.
1. Discrete RV. Takes countably many values. Described by a Probability Mass Function (PMF) , with .
2. Continuous RV. Takes values in an interval. Described by a Probability Density Function (PDF) , with . for any single point; probabilities arise from intervals.
3. Mixed RV. Combination — e.g., insurance payouts that are 0 with non-zero probability and continuous when positive.
4. Multivariate RV (random vector). A vector whose components are jointly random.
Four specific distributions.
1. Bernoulli — Discrete.
PMF: , .
Mean , variance . Models a single yes/no trial.
2. Binomial — Discrete.
PMF: .
Mean , variance . Models the number of successes in independent Bernoulli trials. Used in A/B testing, quality control.
3. Poisson — Discrete.
PMF: .
Mean , variance . Models the count of rare independent events in a fixed time/space window — call-centre arrivals, defects per page, photons per pixel.
4. Normal — Continuous.
PDF: .
Mean , variance . The most important continuous distribution — by the Central Limit Theorem, sample means of any finite-variance distribution converge to normal as . Models measurement errors, heights, IQ scores, asset returns.
(Two more common ones, for context.)
5. Exponential — Continuous. PDF . Mean . Models inter-arrival times in a Poisson process — waiting times, lifetimes.
6. Uniform — Continuous. PDF on . Mean . Models complete equal-likelihood — basis of inverse-transform sampling.