VivaPrep

Cheatsheet

Every formula, comparison table, and quick fact from all 9 modules, on one page — built for a last scroll-through the morning of the viva.

1. ML Fundamentals

full module →

Accuracy

(TP + TN) / Total

Misleading on imbalanced data.

Precision

TP / (TP + FP)

Of flagged positives, how many were right.

Recall

TP / (TP + FN)

Of actual positives, how many were caught.

F1 score

2·(P·R) / (P + R)

Harmonic mean of precision & recall.

Total error

Bias² + Variance + Noise

The bias-variance decomposition.

Confusion matrix

Predicted +Predicted −
Actual +TPFN
Actual −FPTN

L1 vs L2 regularization

L1 (Lasso)L2 (Ridge)
PenaltyΣ|w|Σw²
EffectSome weights → exactly 0All weights shrink smoothly
Good forFeature selectionMulticollinearity

Bagging vs boosting

BaggingBoosting
TrainingParallel, independentSequential, each fixes last
ReducesVarianceBias
ExampleRandom ForestGradient Boosting
  • Underfit = high = poor on train AND val.
  • Overfit = high = great on train, poor on val.
  • CV: average the score across k train/val splits.
  • Fit preprocessing (scalers etc.) on train fold only — never on the full dataset.

2. Neural Networks & Deep Learning

full module →

Sigmoid

σ(x) = 1 / (1 + e⁻ˣ)

Squashes to (0, 1).

Sigmoid derivative

σ'(x) = σ(x)·(1 − σ(x))

Reuses the forward-pass output.

ReLU

max(0, x)

Cheap, no saturation for x > 0.

Neuron output

a = f(Σ wᵢxᵢ + b)

Weighted sum + bias, then activation f.

Activation cheat table

FunctionRangeTypical use
Sigmoid(0, 1)Binary output layer
Softmax(0,1), sums to 1Multi-class output layer
ReLU[0, ∞)Hidden layers (default)
tanh(−1, 1)Hidden layers (older nets, RNN gates)

Vanishing/exploding gradient fixes

ProblemFix
Vanishing gradientReLU family, batch norm, residual connections, He/Xavier init
Exploding gradientGradient clipping, careful init, lower learning rate
  • = compute prediction. = compute how each caused the error.
  • No anywhere = whole network collapses to one linear function.
  • normalizes per , speeds up + stabilizes training.
  • → spatial locality (images). / → sequences. → parallelizable long-range context.

3. NLP Essentials

full module →

TF-IDF

TF(t,d) × log(N / DF(t))

Term frequency × inverse document frequency.

Attention weight

softmax(Q·Kᵀ / √d)·V

Query-Key similarity → weighted sum of Values.

Text representation evolution

MethodUnderstands context?Notes
TF-IDFNoSparse, frequency counts only
Word2Vec / GloVeNo (fixed per word)Dense, similar words are close
Transformer embeddingsYesSame word, different vector by sentence

BERT vs GPT

BERTGPT
PretrainingMasked language modelingNext-token prediction
ContextBidirectionalLeft-to-right (causal)
Best atUnderstanding (classification, NER)Generation (chat, completion)
  • () means the never truly hits an "unknown word."
  • is crude/fast; is grammar-aware/correct.
  • : no training needed, use a pretrained with a prompt.

4. Math for AI

full module →

Bayes' theorem

P(A|B) = P(B|A)·P(A) / P(B)

Update belief given new evidence.

Eigen equation

A·v = λ·v

v = eigenvector, λ = eigenvalue.

Expectation

E[X] = Σ x·P(x)

Probability-weighted average.

Variance

Var(X) = E[(X − E[X])²]

Spread around the mean.

Chain rule

dy/dx = f'(g(x))·g'(x)

The math behind backprop.

Distributions at a glance

DistributionModels…Example
NormalContinuous, symmetric measurementsTransaction amounts (log scale)
BernoulliSingle binary trialIs this one transaction fraud?
Binomialn Bernoulli trialsFraud count in n transactions
PoissonRare events per fixed intervalFraud alerts per hour
  • = number of independent directions of information in a matrix.
  • = eigenvectors of the covariance matrix, ranked by ( captured).
  • : sample means trend normal regardless of the original distribution.
  • A rare condition + an imperfect test ⇒ most positives are false positives (base-rate fallacy).

5. DSA Refresher

full module →

Big-O growth (best to worst)

NotationNameExample
O(1)ConstantArray index access, hash lookup
O(log n)LogarithmicBinary search
O(n)LinearSingle loop / scan
O(n log n)LinearithmicGood sorting (merge/quick sort)
O(n²)QuadraticNested loop / naive pair check

Which structure for which job

NeedUse
Instant lookup / dedup / countingHash map
Sorted-input searchBinary search
Best contiguous subarray/substringSliding window
Pair/triplet in sorted arrayTwo pointer
Shortest path, unweightedBFS
Explore all paths / backtrackingDFS
  • Always state time AND space complexity after solving.
  • Reverse a linked list: three pointers — prev, curr, next.
  • Cycle detection: Floyd's fast-slow pointer.
  • Merge two sorted arrays: two pointers, always copy the smaller — the heart of merge sort.

6. Python / SQL / Data Manipulation

full module →

SQL clause order

ClausePurpose
SELECTPick columns
WHEREFilter rows before grouping
GROUP BYBucket rows sharing a value
HAVINGFilter after grouping (on aggregates)
ORDER BYSort results

JOIN types

TypeReturns
INNER JOINOnly rows matching in both tables
LEFT JOINAll left rows, NULLs where no match on the right

pandas quick reference

TaskCode
Filter rowsdf[df.col > x]
Group + aggregatedf.groupby('col').agg(...)
Join two tablesdf.merge(other, on='key')
Fill missingdf.fillna(value)
  • core: distances → np.argsort → majority vote of nearest K labels.
  • Always shuffle before a train/test split unless order is meaningful (time series).

7. Scenario & System Design for ML

full module →

The 6-step framework

#Ask
1Goal — what does success mean, in business terms?
2Data — what exists, what's missing, how skewed?
3Approach — simplest baseline first, justify complexity
4Evaluation — the right metric, not just accuracy
5Constraints — latency, cost, interpretability, fairness
6Failure modes — what breaks, how would you notice?

Loss curve diagnosis

PatternDiagnosis
Both high & flatUnderfitting
Train low, val high & divergingOverfitting
Both dropping, val noisy/spikingLearning rate too high
Both dropping, painfully slowLearning rate too low
  • Say the framework out loud before naming any technique.
  • "Count objects in video" is a tracking problem ( + track IDs), not just detection.
  • No labels yet? / zero-shot → bootstrap labels → distill to a small fast .
  • Lending models must be explainable — a regulator can demand the reason for every rejection.
  • Never hard-swap a that only won offline: shadow → canary → ramp, with rollback ready.

8. Research Paper Reading

full module →

The 4-part paper summary

PartQuestion
ProblemWhat gap/limitation motivated this?
MethodCore idea in 1-2 sentences
FindingsWhat did they show, vs which baseline?
ImplicationWhy should anyone care?

Efficient reading order

OrderSection
1Abstract
2Conclusion
3Figures / tables
4Introduction
5Skim: Method
6Skip on first pass: most of Related Work
  • Budget under 2 minutes to summarize any paper out loud using the 4-part structure.
  • Naming one honest limitation of your own work reads as more mature than claiming none.

9. Viva Soft Skills

full module →

60-second self-intro shape

~20s~20s~20s
BackgroundOne concrete project/thesis hookWhy this role, specifically
  • Everything on your CV is fair game — only list what you can defend in depth.
  • Prepare 2 genuine questions for the panel; skip salary/benefits in a technical round.
  • Rehearse out loud, timed — recognizing an answer while reading is not the same as saying it fluently.