COMP20008 Cheatsheet · Elements of Data Processing

University of Melbourne · Cheatsheet for the final exam. Semester 2 examination period, 2–20 November 2026. Full COMP20008 study guide →

A4 landscape · two sides · 6 columns · methods, decisions and drills COMP20008 · S2 2026 · revision sheet
COMP20008
Elements of Data Processing
Information Technology · University of Melbourne · second-year undergraduate
Exam Revision Sheet
S2 2026 · Side 1 of 2
Definitions · rules · formulas
COMP20008 cheatsheet QR code – open the full COMP20008 study guide
Full guide + ask Sia
about COMP20008
SIDE 1/2   EXAM MAP → method rules → formulas → comparisons → standard critiques S2 2026 · 50% final examination Revision priority: choose → calculate → interpret → critique

01 · Exam map course.json · brief

Continuous / project 50%Examination 50%

Continuous / project assessment — 50% · End-of-semester examination — 50%.

Permitted materials: not confirmed for this offering in the course materials we hold — check the exam instructions on the LMS.

Rewarded moveWrite in this order
Calculateformula → substitution → answer → meaning
Compareaxis → A → B → consequence
Critiquefailure cause → symptom → mitigation

02 · Pipeline + types C01

INPUTtypesCLEANscaleMODELlearnOUTshowUSEethics
Source-derived pipeline: locate the stem first; the legal method belongs to that stage.
TestClassExamples
Arithmetic meaningful?Numericaltemperature, income; discrete counts / continuous range
Label or identifier?Non-numericalpostcode, phone number
Ordered category?Could-be-eitherS/M/L; code 1/2/3 if justified
Measurement laddernominal: labels < ordinal: order < interval: equal gaps, no true 0 < ratio: equal gaps + true 0

Do not classify by appearance. “3010” is non-numerical when it is a postcode. Separate this from dataset structure: table = structured; keys/tags = semi-structured (JSON/XML/HTML); free text/images = unstructured.

Privacy decision rule

SELFperson actsLOCALalter recordGLOBALalter answer
Source-derived privacy levels: protection may act at the person, record or query-answer level.
Release riskRule
re-identification by quasi-identifiersk-anonymity: every pattern matches ≥k records
one sensitive value throughout a k-grouphomogeneity attack → require ≥l distinct values
query answer reveals one personglobal DP: add noise scaled to sensitivity

03 · Clean before model C02

AUDIT: accurate · complete · consistenttimely · believable · interpretableDROP?IMPUTE?SCALE?
Source-derived quality gate: diagnose the dimension, then choose a repair and name its cost.
If you see…Do / say
rare, apparently random missingnessdrop a few rows; loss is small
many/predictable missing valuesimpute: mean/median/mode, fill, regression or k-NN; may bias and dampen variance
mixed dates/namesstandardise representation; de-duplicate
extreme valueverify; cap/remove or use robust method; never delete silently
Scaling — bites before k-NN, k-means, PCAmin-max: x′ = (x − min)/(max − min) ∈ [0,1]
z-score: z = (x − x̄)/s → mean 0, SD 1

Min-max is bounded but one extreme stretches the range and compresses the rest. z-score uses standard-deviation units and is less squashed by an extreme. Scaling prevents units with a large numeric range from dominating distance/variance.

Sampling

Random: every record equally likely. Stratified: sample inside groups to preserve proportions. Systematic: every kth record. Always ask whether the scheme is representative; saving cost is not worth selection bias.

Ground an LLM answer

queryretrievechunksaugmentanswerpermission gate surrounds retrieval
Source-derived RAG: retrieve permitted evidence, add it to the prompt, then generate.

Why: an LLM predicts plausible tokens rather than checking facts; retrieval grounds output and reduces hallucination. Content partitioning: chunk for relevance and enforce permissions so one user’s data cannot enter another answer. AUTOMAT: Act-as, User, Targeted-action, Output, Mode, Atypical cases, Topic.

Trap “Impute” is incomplete: name the method and the bias ↔ information-loss trade-off.

04 · Capture → clean text C03–04

CRAWL · coverageseedpagepageSCRAPE · fieldstitlepricedate
Source-derived contrast: crawling follows links; scraping extracts named DOM fields.
AxisCrawlingScraping
Goalcoverage/indexingstructured data
Movefrontier; breadth-first linkstargeted DOM parsing
OutputURLs/raw pagesfield table
Controlrobots.txt + visited setfind_all() + get_text()
Scraping assembly lineseed URL → fetch HTML → parse DOM → find_all(target nodes) → get_text(strip tags) → standardise → clean matrix

Flawed crawler: no visited set means duplicates re-enter the frontier, cycles repeat, unique coverage stalls and termination fails. Deduplicate before enqueue/fetch; stop at the target count of unique URLs.

sentencesplittokenisenormaliselemmafilter /n-grams
Source-derived text pipeline: order matters; clean tokens feed BoW/TF-IDF.
LemmatiseStem
dictionary + grammar; valid base: better→goodsuffix rule; may be non-word: studies→studi

Splitting needs exceptions for abbreviations and decimals. Lowercase/strip punctuation to merge forms. Lemmatisation shrinks sparsity; stop-word removal drops ubiquitous noise; n-grams restore short local order but enlarge vocabulary.

Failure symptomDiagnosis → repair
“Dr. Lee” becomes two sentencesnaive full-stop split → add abbreviation/number exceptions
“The”, “the”, “the,” become three featuresmissing normalisation → lowercase + strip punctuation
chase/chased/chasing stay separatesurface forms → lemmatise to one dictionary form
crawler revisits navigation foreverno visited set → check before enqueue and fetch

Answer shape Name the stage, show its input→output, then state the downstream benefit.

05 · Vectorise + visualise C05

fixed shared vocabularythefoxhenchaseD1D221011022
Source-derived BoW: rows are comparable only after vocabulary alignment and zero padding.

BoW counts terms over a fixed vocabulary. It is simple, interpretable, fixed-length and language-agnostic; it also discards order/semantics, is sparse/high-dimensional and lets common terms dominate.

Distance + weightingd(x,y) = √(Σᵢ(xᵢ−yᵢ)²)
TF-IDF(t,d) = TF(t,d) × IDF(t)
IDF(t) = log(N/df(t))
UseRuleFailure
raw TFfrequency within documentubiquitous words swamp topics
TF-IDFdown-weight high df; up-weight distinctive termsstill sparse; still loses order
n-gramsretain short phraseslarger vocabulary

Chart decision

categoriesbartime/orderline
2 numericscatterdistribution/groupsboxplot
matrixheatmap——
raw: spread visiblebins: tidy trend
Source-derived binning trap: averages smooth noise, hide variance and can exaggerate a trend.

Representation diagnosis

NeedRepresentationReason
interpretable countsBoWfixed coordinates; easy distance
topic distinctionTF-IDFdistinctive terms outweigh ubiquitous ones
short phrase/ordern-gramsretain local sequence, but expand vocabulary
word contextwindowed co-occurrencecount neighbours around each target occurrence

For a critique, separate representation loss (order/semantics discarded) from weighting failure (common terms dominate) and match the fix to the failure.

06 · Cluster + reduce C06–08

k-means loopassignmeancentroidSSE elbowchoose bend; k=3
Source-derived k-means and elbow: fit improves with k, so do not minimise SSE blindly.
k-means — where it bitesrepeat: nearest-centroid assignment → centroid = mean of members → convergence
SSE = Σclusters Σpoints ‖x − μcluster‖²

Elbow: plot SSE against k; pick the bend where marginal reduction collapses. Advantage: simple/visual. Limitation: bend may be ambiguous/subjective; silhouette or Calinski–Harabasz are alternatives. Outlier: squared distance inflates SSE and drags a centroid or consumes a cluster. Remove/cap after verification, scale, or use k-medoids/density methods.

MethodCluster distance / choiceSignature
k-meansnearest mean; set k firstflat; outlier-sensitive
single linkminimum pair distancechaining
complete linkmaximum pair distancecompact
average linkmean pair distancecompromise
VATreordered distance matrixdark diagonal blocks suggest k
cutABCDy = merge distance
Source-derived dendrogram: cut horizontally; count crossed branches for the cluster count.

PCA

Project onto orthogonal directions of maximum variance: PC1 most, PC2 next. Variance ≠ target relevance. A low-variance direction may separate classes; scale first because PCA is variance-sensitive.

Compare clusterings

Treat each clustering as a categorical labelling and compute NMI: near 1 means the labellings agree; near 0 means they disagree. It compares partitions even when cluster names differ. Do not confuse this use with VAT, which diagnoses cluster tendency before fitting.

07 · Dependence → prediction C08–12

linearhigh |r| + high MIy = x²r≈0; MI high
Source-derived dependency test: Pearson sees a line; MI sees any dependence.
Uncertainty formulasH(X) = −Σᵢ pᵢ log₂pᵢ
MI(X,Y) = H(Y) − H(Y|X)
NMI = MI/min(H(X),H(Y))

Pearson r ∈ [−1,1]: signed linear association; misses curved/non-monotone structure. MI: 0 iff independent; detects non-linear/categorical dependence, but has no sign and continuous data needs discretisation. Entropy is 0 when deterministic; binary entropy is 1 bit at 50/50.

StemChoose / warning
predict class from labelled rowsclassification: k-NN/tree
predict continuous valueregression: ŷ=b₀+b₁x; least squares
small local neighbourhoodk-NN; scale; k small noisy, k large smooth
interpretable recursive rulestree; depth controls overfit
near-unique categoryinformation gain biased to high cardinality → pure leaves, memorisation
Evaluation — derive from TP/FP/FN/TNAccuracy=(TP+TN)/N
Precision=TP/(TP+FP)
Recall=TP/(TP+FN)
F1=2PR/(P+R)

Metric by error cost: false negative costly (fraud/cancer) → recall; false positive costly → precision. Accuracy can hide failure on imbalanced data. k-fold CV rotates the held-out fold and averages scores; every row is tested once.

Leakage: target or future-only data appears among features; “perfect” training MSE can be invalid because the value is unavailable at prediction. Audit availability before fitting.

k-NN: scale, tune k?●●○tree: tune depthbest split
Source-derived supervised choices: neighbourhood size controls locality; tree depth controls complexity.

Feature selection: filter methods rank features (correlation/MI), wrapper methods search subsets by model performance, and embedded methods select during fitting. Verification: public key → recompute statement hash → compare with signed hash; a blockchain edit changes a hash and breaks later links.

asksia.ai/cheatsheet/unimelb-comp20008 · Full COMP20008 study guide →
Check your exam instructions on the LMS for what you may bring; use this sheet to revise and self-test.
AskSiaForward this to your tutorial group · Shared by ________
v2 · 2026-10-25
Semester 2 examination period, 2–20 November 2026.
COMP20008
Elements of Data Processing
Information Technology · University of Melbourne · second-year undergraduate
Exam Revision Sheet
S2 2026 · Side 2 of 2
Self-test · answers · traps
COMP20008 cheatsheet QR code – open the full COMP20008 study guide
Full guide + ask Sia
about COMP20008
SIDE 2/2   WORKED MINI-EXAMPLES → judgement cards → traps → exam-morning recall Self-test: cover answers first Show the path; finish every number with meaning

08 · Drill: classify + clean WE C01–02

Arithmetic meaningful?NOYESlabel / IDNON-NUMERICALNUMERICALcount / rangeordered → either
Source-derived Q1 decision tree: answer from meaning, not typography.
ValueAnswer path
postcode “3010”arithmetic meaningless → non-numerical identifier
temperature °Cnumerical, continuous, interval: equal gaps; no true zero
T-shirt S/M/Lordered category → could-be-either; ordinal 1/2/3 if justified
phone numberidentifier; leading zeros matter → non-numerical

Answer: non-numerical; numerical; could-be-either; non-numerical. Each label needs its reason.

Quality mini-answer

Inconsistent representation: “13/02/19”, “13th Feb 2019”, “2019-02-13” in one date column → standardise before parse/sort. Missing: blank DOB or “20 years ago” breaks age calculation → drop if rare/random; otherwise justify imputation.

If you see X→ do Y
distance model + mixed unitsscale first
bounded range, no extremesmin-max
extremes / SD units desiredz-score
few random missing rowsdrop, state information loss
many model-able gapsimpute, state bias/variance cost

Exam-morning plan

  1. Confirm the LMS instructions and timing; recite the formulas once, then stop cramming.
  2. Recall six anchors: type test; scaling; vector alignment; linkage rule; metric denominators; privacy distinction.
  3. For every stem: identify stage/output, choose method, show working, state meaning, add one limitation.
  4. If stuck, write the decision rule and a concrete consequence; a method name alone is not a critique.

Say aloud Accuracy, completeness, consistency, timeliness, believability, interpretability.

09 · Drill: BoW distance WE C04–05

Text: “The fox saw the hen and chased it. The hen turned and chased the fox.” Window = two words either side; exclude target.

the · saw · chased · it · turned · andfoxhen211000102111six component differences, each ±1 → √6
Source-derived worked vector: align the union vocabulary before subtracting.
  1. Contexts: fox → the=2, saw=1, chased=1. Hen → chased=2, it=1, the=1, turned=1, and=1.
  2. Union vocabulary: {the, saw, chased, it, turned, and}. Pad absent terms with 0.
  3. fox=(2,1,1,0,0,0); hen=(1,0,2,1,1,1).
Substitute all six dimensionsd = √[(2−1)²+(1−0)²+(1−2)²+(0−1)²+(0−1)²+(0−1)²]
= √(1+1+1+1+1+1) = √6

After lemmatisation: chased→chase, turned→turn, saw→see. Hen context becomes chase=2, it=1, the=1, turn=1, and=1. Counts collapse onto valid base forms, shrinking and de-sparsifying the vocabulary.

TF-IDF judgement

Cooking posts cluster poorly under raw TF because “the”, “recipe”, “cup”, “minutes” dominate every vector. IDF down-weights terms appearing in many documents and up-weights “sourdough”, “tempering”, “marinade”: distinctive words distinguish topics.

TF count×IDFlog(N/df)=topicweight
Source-derived weighting: a term matters when frequent here but uncommon across documents.

Classic traps — antidotes

  • BoW: “dog bites man” = “man bites dog”; add n-grams if local order matters.
  • Elbow: SSE falls with every larger k; choose the bend, never the raw minimum.
  • Single link: one near bridge can chain remote groups.
  • PCA: high variance may be irrelevant to the target.
  • Tree: high-cardinality purity may be memorisation.
  • RAG: grounding reduces hallucination, but chunking and permissions still govern quality and leakage.

10 · Drill: linkage + clusters WE C06–07

Points: A=1, B=3, C=4, D=8. Pair distances: AB=2, AC=3, AD=7, BC=1, BD=5, CD=4.

single: 1, 2, 4ABCDcomplete: 1, 3, 7ABCDcut below final merge→ {A,B,C} | {D}
Source-derived worked dendrogram: same two-cluster cut, different merge heights.
  1. Smallest distance BC=1 → merge {B,C} for both.
  2. Single: {BC}–A=min(2,3)=2; then {ABC}–D=min(7,5,4)=4. Heights 1,2,4.
  3. Complete: {BC}–A=max(2,3)=3; {BC}–D=max(5,4)=5, so merge A; then {ABC}–D=max(7,5,4)=7. Heights 1,3,7.
  4. Cut just below the last merge → {A,B,C} and {D}.
If you see X→ do Y
need k before fitting?k-means: use VAT/elbow; elbow may be subjective
nested relationships / choose k laterhierarchical + dendrogram cut
straggly chainingsingle linkage caused it
compact-diameter preferencecomplete linkage
far outlier + squared distancecentroid dragged; robustify or change method

PCA / dependence card

If PC1 has 95% variance, it is useful for compression/visualisation, not proof of relevance. If x=−3,…,3 and y=x², symmetry cancels the linear trend: r≈0. Yet y is determined by x, so MI/NMI is high. Pearson limitation = linear only; MI limitation = no sign and continuous data needs binning.

Mini self-testAnswer path
SSE curve has no clear bendelbow is ambiguous; report subjectivity and consider silhouette/Calinski–Harabasz
VAT has three dark diagonal blocksthree groups of mutually close points; try k=3
two partitions use different label namescompare assignments with NMI; names themselves do not matter
PC1 explains most variancecompression cue only; test relevance to the target before discarding PCs

Full-credit clustering answer: define the distance rule, carry each merge height, state the cut, then name the geometry it favours.

11 · Drill: metrics + leakage WE C09–10

Fraud classifier, N=1000: TP=30, FP=20, FN=10, TN=940.

ACTUALpositivenegativePREDICTEDpositivenegativeTP30FP20FN10TN940precision row · recall column
Source-derived matrix: orient the cells before touching a formula.
Carry the numbers to the endAccuracy=(30+940)/1000=0.97
Precision=30/(30+20)=0.60
Recall=30/(30+10)=0.75
F1=2(0.60·0.75)/(0.60+0.75)=0.90/1.35≈0.667

Judgement: prioritise recall because a missed fraud is the costly false negative. Accuracy 0.97 is misleading: legitimate transactions dominate, so a majority-only model can look strong while catching little fraud.

If costliest error is…OptimiseWhy
false negativerecallcatch actual positives
false positiveprecisiontrust positive predictions
bothF1harmonic balance
5-fold CV: rotate held-out foldTESTTRAIN ×4target yfeature ycopy target → MSE 0 = leakage
Source-derived evaluation: honest held-out scoring; a target-feature shortcut is invalid.

Tree trap: ~80 nearly unique colour values create pure leaves because information gain favours high cardinality; the tree memorises. Coding colours 1–80 fabricates order and thresholds. k-NN trap: new users have tiny Jaccard overlap |A∩B|/|A∪B|; use content/hybrid/popularity priors.

Regression + selection check

PromptFull-credit move
interpret b₁Δŷ per +1 unit x; least squares minimises squared residuals
report R²share of y-variation explained; high R² is not proof of causality
choose featuresfilter ranks correlation/MI; wrapper searches subsets; embedded selects during fitting
evaluate honestlyhold out unseen rows or rotate k folds; keep test sealed

12 · Drill: privacy + trust WE C11–12

Scenario: table is 2-anonymous on {age-band, postcode}; a two-record group {50–59, 30**} has Diabetes for both rows.

k=2: WHO hidden50–59 · 30**Diabetes50–59 · 30**Diabetessame sensitive valueHOMOGENEITYl=2: WHAT hidden50–59 · 30**Diabetes50–59 · 30**other condition≥2 sensitive valuesless utility
Source-derived privacy fix: k-anonymity hides identity; l-diversity protects the sensitive value.
  1. 2-anonymity holds: every QI pattern matches at least one other row.
  2. Yet locating the target in the group reveals Diabetes with certainty: homogeneity attack.
  3. Enforce l-diversity: each QI group has ≥l distinct sensitive values, via coarser grouping/merging/suppression.
  4. Trade-off: more generalisation improves privacy but reduces utility.
query truthR=12mean-0noiserelease14 or 11more noise → privacy ↑ · accuracy ↓
Source-derived global differential privacy: query, perturb, release; sensitivity sets noise scale.
TermFast distinction
copyrightexpression; automatic
patentnovel invention/process; registered, time-limited
trademarkbrand identifier
self / local / globalindividual protects / alter record / alter query answer

Digitally signed credential: obtain issuer public key → recompute exact statement hash → verify signature resolves to the same hash. Match proves issuer authenticity + content integrity. Chain: each header stores the previous-header hash; changing earlier data changes its hash and breaks later links.

Trap Mean-0 noise does not mean zero noise; one release varies while repeated expectation returns the truth.

Bias diagnosis

SignalDiagnosis
under-represented grouprepresentation bias → worse performance
flawed feature/label proxymeasurement bias → misses target
sensitivityone-record maximum change → noise scale

13 · Method chooser All chapters

What does the stem ask?representtext?findgroups?predict /evaluate?BoW/TF-IDFn-gram orderk-means/HCVAT/elbow/cutk-NN/tree/reg.CV + metric
New decision figure: method selection starts from the question’s output, not a favourite algorithm.
If you see X→ do Y / say why
digits used as an identifiernon-numerical; arithmetic meaningless
web links/frontier/coveragecrawler + robots.txt + visited set
named fields in one DOMscrape: find_all → get_text
common words blur topicsTF-IDF
distance/variance methodscale first
unknown k / tendencyVAT then elbow; state ambiguity
curved dependenceMI/NMI, not Pearson alone
imbalanced positivesprecision/recall/F1, not accuracy alone
too-perfect training scoreaudit leakage; evaluate held out
shared sensitive value inside k-grouphomogeneity → l-diversity
model answer needs sourcesRAG retrieve → augment → generate; enforce permission gate
CLASSFORMULAMEANINGCRITIQUEname the limitation + consequence + fix
New exam-morning loop: the interpretation and limitation are part of the answer.

Final check Units and denominators; train/validation/test roles; target unavailable at prediction; no unsupported causal language.

Evaluate cues

SignalCheck / fix
binned trend looks stronginspect raw scatter: binning exaggerates a trend and hides spread
fluent but falsehallucination predicts likely tokens without grounding; use permitted RAG chunks
credential trustpublic key → recompute hash → verify signature; match = authenticity + integrity
near-zero Pearsoninspect scatter or use MI before declaring independence
asksia.ai/cheatsheet/unimelb-comp20008 · Full COMP20008 study guide →
Check your exam instructions on the LMS for what you may bring; use this sheet to revise and self-test.
AskSiaForward this to your tutorial group · Shared by ________
v2 · 2026-10-25
Semester 2 examination period, 2–20 November 2026.

Want one for YOUR exact syllabus?

Sia is your free desktop study agent. Drop your University of Melbourne COMP20008 slides — Sia builds a sheet tailored to YOUR exam. Better than this library because it knows YOUR materials.

↓ Download Sia · Free