























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























A topic-by-topic guide covering big data foundations, statistics, data cleaning, high performance computing, and the core machine learning methods used in data analytics at scale. Original study notes — independently written summary and explanation
Solutions: general data cleaning; for unstructured data specifically, transforming it into structured form where possible, storing it using newer technologies such as NoSQL databases, and processing it with analytical techniques built for unstructured content.
Veracity is essentially a measure of data quality: the degree to which data are accurate, unbiased, and trustworthy. Challenges: data are often collected for one purpose but later reused for a different one it wasn't designed for, and quality can vary unevenly across a dataset. Solutions: domain expertise is essential for spotting quality issues, alongside systematic data cleaning and data governance policies that standardise how data is collected and processed.
Challenge: understanding how a business can actually extract value from its Big Data, rather than simply accumulating it. Solutions: a cost/benefit analysis can help establish whether processing the data is worthwhile — this becomes more favourable as the cost of storage continues to fall.
HPC is the use of specialised computing systems to solve complex problems at scale. The same factors that define Big Data — volume, velocity, and variety — are what typically force analysts beyond the limits of a standard desktop machine. When more CPU power, memory, or storage is required than a conventional setup can provide, the task needs "scaling" — expanding the computational resources available to it. There are two broad approaches:
A number of established frameworks describe how a data analytics project should proceed from start to finish. They share a broadly similar shape but differ in emphasis.
CRISP-DM is the most widely referenced framework, describing commonly used approaches to data analytics problems. It is cyclical rather than strictly linear, and consists of six phases:
Data used in a project can come from several types of source:
A population is the entire collection of people, animals, or things that share a common characteristic of interest. A sample is a subset of units drawn from that population. If the sample size is n, the data can be written as x = (x₁, x₂, ..., x ).ₙ The general goal of a statistical analysis is to find a model that plausibly describes how the characteristic of interest behaves. A sensible strategy is to: (1) consider the type of data; (2) explore it through summary measures and graphs to identify its key features; and (3) choose a model that could reasonably have generated the observed data.
A handful of summary statistics are used repeatedly throughout data analytics:
For quantitative data: boxplots, histograms, scatterplots, and time-series plots. For qualitative data: frequency tables and bar charts.
A random variable (RV) is a variable whose possible values are the numerical outcomes of a random event. A discrete RV only takes distinct values (e.g. 0, 1, 2, ...); its probability mass function f(x) = P(X = x) gives the probability of each possible value, and these probabilities must sum to 1. The cumulative distribution function is F(x) = P(X ≤ x) = Σ f(y) for y ≤ x, from which P(X > x) = 1 − F(x). The expected value E(X) represents the long-run average outcome of repeating the experiment: E(X) = Σ x·f(x). The variance is Var(X) = E[X − E(X)]² = E[X²] − E[X]².
Describes a single trial with two outcomes — success (1) or failure (0) — such as one coin toss. If p is the probability of success, then E(X) = p and Var(X) = p(1 − p).
Describes the total number of successes across n independent Bernoulli trials, each with success probability p — essentially, "many Bernoulli trials at once". Its mean and variance are E(X) = np and Var(X) = np(1 − p).
Used to model rare events — effectively the limiting case of a Binomial distribution with a large n and a small p. Both its mean and variance equal the rate parameter λ: E(X) = Var(X) = λ. A classic example is modelling the number of goals scored in a football match.
A continuous RV can take an uncountable number of possible values, so the probability of it taking any single exact value is zero. Instead, probability is described by a probability density function f(x), where the probability of the RV falling in an infinitesimally small interval dx is f(x)dx, and the total area under f(x) integrates to 1.
The most important continuous distribution, characterised by its mean μ and variance σ². Its density is bell-shaped and symmetric around μ.
Large sums of random variables with finite variance approximately follow a Normal distribution — one of the reasons the Normal distribution appears so often in statistics.
MLE is a method for working out which parameter values were most likely to have generated an observed dataset. The likelihood function L(θ, x) is the joint probability (or density) of the observed data, viewed as a function of the unknown parameter θ, given by the product of the individual densities: L(θ, x) = ∏ f(xᵢ, θ). The value θ̂ that maximises this likelihood is the maximum likelihood estimate — the most plausible model for the observed data. In practice it is usually easier to work with the log-likelihood, l(θ, x) = log L(θ, x), since the logarithm turns the product into a sum.
Data cleaning and preparation form a large part of any data project's lifecycle. The guiding principle is simple: garbage in, garbage out — the veracity of the data is crucial to achieving any meaningful analytical goal. For results to be valid, datasets need to be:
Before cleaning begins, it is important to understand a dataset's history: how was it created? Have any transformations already been applied? Are there known problems, such as miscalibration of a measuring instrument? What assumptions can reasonably be made, and could the data contain hidden biases? Metadata often provides useful clues here.
Cleaning is best thought of as a cyclical, iterative process with four stages: inspection, cleaning, verification, and reporting. Each stage feeds back into the others as issues are discovered.
Goal: understand the dataset's qualities, verify assumptions, and detect errors — in short, "trust but verify". This is closely tied to EDA, and typically covers data types, profiling (min/max/mean/standard deviation), and visualisation (distributions, histograms, correlations).
Goal: fix the issues found during inspection, or remove invalid data. This happens in two broad steps: first, converting raw data into a technically correct form; second, converting technically correct data into a consistent form suitable for analysis.
Goal: confirm that the cleaned data meets expectations, and that any specified constraints or business rules have actually been satisfied.
Cleaning steps and modifications should be documented, both to demonstrate that the data is ready for analysis and to preserve provenance for future users. Continuous improvement matters too — reviewing how errors arose can feed back into how data is generated or collected in future. Reproducibility is also important: scripts and documentation should be kept in a version control system such as Git, since the cleaning process may need to be repeated or verified later.
Technically correct data means that each value can be directly recognised as belonging to a specific variable, and is stored using a data type that matches the real-world variable it represents. Concretely: numeric values are stored as numbers rather than text; dates and times use appropriate formats rather than free text; and formatting is consistent throughout the dataset.
Common techniques include parsing numeric and date values out of strings, ensuring consistent character encoding, normalising strings (e.g. removing stray whitespace), and re-coding categorical variables into a consistent scheme (e.g. standardising "f" and "female" to a single category).
Consistent data is technically correct data that is genuinely fit for statistical analysis. This requires:
Missing data must be understood and handled before analysis. Software typically represents missingness with a special value (e.g. None in Python) — and it's important not to confuse a genuinely missing value with a valid default or category ("unknown" can itself be a meaningful category). Ideally, the reason data are missing should be understood before deciding how to handle it. Options include removing the affected record (reasonable when only a small number of records are affected), imputing a replacement value such as the mean, or removing the feature entirely if it is too sparse to be useful.
An outlier is an observation that lies abnormally far from the main body of the distribution. Outliers are not automatically errors — they should be detected, but not automatically removed. Whether to include them in an analysis is a statistical judgement, not an automatic rule. They are typically found through distribution visualisations such as boxplots, density plots, and histograms.
These occur when a record contains a value, or combination of values, that cannot correspond to a real-world situation — for example, an under-age person appearing in a dataset of driving licences. Automated checks (e.g. specifying a valid age range) can catch many of these.
Duplicates may need to be removed to keep an analysis valid, though this depends on data provenance — some duplicates are perfectly valid (e.g. multiple prescriptions dispensed at a pharmacy on the same day). In such cases, appending an auto-incrementing identifier to each record can help distinguish genuine repeats from duplication errors.
It can be sensible to remove features that are unrelated to the analytics goal — for example, a customer's email address in a study of spending habits. More importantly, "cheating" features — proxies for the outcome you are trying to predict — should be removed. For example, if a dataset contains a code that identifies early redeemers of an offer, and the goal is to predict who will redeem early, that code needs to be dropped, since it would let the model "cheat" by looking at the answer.
A confounding variable creates an apparent relationship between two variables that is really driven by both variables' relationship with a third variable (the classic example being shoe size and reading ability in children, both really driven by age). This is why correlation does not imply causation.
Data tidying means structuring datasets to make manipulation, visualisation, and modelling straightforward.
A dataset is considered tidy when:
Normalisation is useful for tidying data and removing inconsistencies. However, many machine learning and modelling libraries expect a single flat table or file as input. Depending on the tool being used, it may therefore be necessary to denormalise data — merging several related tables (relations) back into one large flat table.
By default, software runs on a single system using a single thread of execution. When writing complex programs, or processing large-scale data, parallel execution becomes necessary. This need arises from three main constraints:
Before parallelising anything, it's important to understand a program's performance characteristics. Common approaches include measuring runtime at different problem scales and plotting the results, monitoring system resources during execution, and instrumenting the program with logging or profiling. Profiling in particular calculates the total running time of each function or statement, and how many times each was called — this is essential for finding out where the real bottlenecks are before spending effort optimising the wrong part of the code.
A process represents the executing state of a program. A process contains one main thread of execution and can spawn additional threads; all threads within a process share the same memory space. A thread executes program instructions on a CPU, and threads are scheduled onto CPUs by the operating system. A process may also spawn child processes — unlike threads, child processes do not share their parent's memory space.
Concurrency means decomposing a problem into multiple independent tasks. Parallelism means actually executing multiple tasks at the same time. Multiple threads can run concurrently on a single CPU core, but not truly in parallel — the operating system rapidly switches which thread occupies the core, creating the illusion of parallelism, even though only one thread is genuinely executing at any instant. True parallelism requires multiple cores, each genuinely running a task simultaneously.
The dataset is partitioned across several worker tasks, each of which processes its own subset in parallel. The general pattern is: split the dataset by some heuristic or function, apply a common operation across every partition, then combine (gather) the intermediate results back together. Properties: parallel efficiency scales with problem size, and this approach is straightforward for "embarrassingly parallel" problems — those with no dependencies between tasks. It can be implemented using shared memory on a single node, or message passing across a cluster. Limitations: splitting and combining introduce communication overhead, reducing the theoretical performance gain, and overall performance is limited by the speed of the slowest worker.
Parallel efficiency = t₁ / (N × t_N) This is sometimes referred to as "weak scaling" — how much work can be completed in a fixed time, as opposed to "strong scaling", which asks how much faster a fixed amount of work can be completed.
CPUs are general-purpose computation devices. "Hardware acceleration" refers to using specialised hardware to boost the efficiency of common data processing patterns. Accelerators can be roughly classified into GPUs (Graphics Processing Units), FPGAs (Field Programmable Gate Arrays), and ASICs (Application Specific Integrated Circuits). GPUs were originally designed for graphics rendering in games and 3D modelling, but were later discovered to be excellent for training deep learning models, and are now ubiquitous for that purpose. GPUs are built for high degrees of data parallelism — able to execute the same instruction across many thousands of data points in parallel — though they typically support a smaller instruction set than a CPU. Because GPUs act as co-processors, specialised software libraries (such as PyTorch or TensorFlow) are required to make use of them.
High Performance Data Analytics (HPDA) is the term used for the intersection of big data analytics and high performance computing: Big Data Analytics + HPC = HPDA. In practice, this means using the parallel processing capability of HPC to run large-scale, powerful analytics software.
Python provides built-in high-level libraries for both multi-threading and multi-processing. Libraries such as NumExpr and NumPy can speed up Python code through vectorisation and multi-threading, and some libraries — such as scikit-learn's njobs option — use multi-processing to parallelise tasks like ML training, though in practice the scaling achieved this way is limited. A key constraint is the Python Global Interpreter Lock (GIL), which prevents true multi-threaded parallelism within a single Python process. Each separate Python process, however, has its own GIL. Libraries like NumExpr and NumPy compile down to native code, allowing them to sidestep the GIL restriction.
Apache Spark is an engine for running data engineering, data science, and machine learning workloads, either on a single machine or across a cluster. Key features include support for streaming data, general analytics, data science at scale, and machine learning.
A Spark cluster has three main components: the driver program (which contains the SparkContext), the cluster manager, and the worker nodes (each running executors that carry out tasks and hold cached data). Spark supports several cluster managers, including its own built-in Standalone manager (which makes setting up a cluster straightforward), Hadoop YARN, and Kubernetes.
Spark's core strength is its focus on in-memory computation — intermediate results are held in memory rather than repeatedly written to disk. It offers APIs across multiple languages (Scala, Java, Python via PySpark, SQL, and R), and includes purpose-built libraries for different workflows: Spark ML (machine learning), Structured Streaming, Spark SQL, and GraphX.
Transformations create a new Spark DataFrame without altering the original. They are lazily evaluated, and split further into:
Demand for machine learning and AI has grown enormously, and the surrounding community and tooling has grown along with it. PyTorch, first released in 2016, is primarily used through Python (its underlying engine, Torch, also supports C and Lua). It applies the computational power of Torch to build a modern machine learning library suited to computer vision and natural language processing. It underlies large-scale AI workloads at major technology companies and is used across sectors from customer service to social media. PyTorch supports rapid deployment of new models, flexible computational graphs that can be modified on the fly, and implementation of a wide range of network architectures, including Convolutional Neural Networks (CNNs), Long Short-Term Memory networks (LSTMs), and Recurrent Neural Networks (RNNs). Its design follows three guiding principles: usability over raw performance, simplicity over cleverness, and a Python-first approach.
Usually, solving a problem on a computer requires an algorithm that transforms an input into an output. For some tasks, however, no such algorithm is readily available — machine learning instead extracts a model, or algorithm, directly from data (a spam filter is a classic example: nobody writes an explicit rule for "spam", the system learns one from labelled examples).
Consider predicting a continuous outcome — for example, the weight of a cat's heart from its body weight — using a linear model: y = θ₀ + θ₁x This assumes there is a dependency between X and Y, and that the dependency is linear. Here θ₀ is the intercept (also called the bias), and θ₁ is the slope of the line. Given a training set {(x⁽¹⁾, y⁽¹⁾), (x⁽²⁾, y⁽²⁾), ..., (x⁽ᵐ⁾, y⁽ᵐ⁾)}, the model's predictions are h(x) = θ₀ + θ₁x, and the cost (mean squared error) is: Cost = (1/m) × Σ (y⁽ⁱ⁾ − hθ(x⁽ⁱ⁾))² The goal is to find the values of θ₀ and θ₁ that minimise this cost, giving the best linear prediction.
Gradient descent finds these optimal parameters iteratively: start with arbitrary initial values, then repeatedly adjust the parameters to reduce the cost, using the gradient to determine the direction that reduces cost, until the minimum is reached.