This page puts the metrics, formulas and comparisons behind most AI, Machine Learning & Data Analytics questions on one sheet. The area carries 10% of the NSCT per HEC's Areas of Competencies, and 2026 candidates averaged 50.8% accuracy in it per the HEC NSCT report and APP. Print it (or save it as a PDF from your browser) and keep it next to your practice.
Key definitions
Term
One-line meaning
AI ⊃ ML ⊃ DL
Deep learning is a subset of machine learning, which is a subset of AI
Supervised
Learns from labelled data (regression = continuous target, classification = discrete)
Unsupervised
No labels: clustering, dimensionality reduction, association rules
Reinforcement
Agent learns from rewards
Self-supervised
Labels generated from the data itself (masked words, next token)
Validation set
Tunes hyperparameters; the test set is used once at the end
Data leakage
Information from outside the training data reaches the model
Overfitting
Low training error, high test error (high variance)
Underfitting
High error on both (high bias)
Hyperparameter
Set before training (k, learning rate, depth), not learned
Epoch
One full pass over the training data
Data drift / concept drift
P(X) changes / P(y|X) changes
Analytics types
Type
Question
Descriptive
What happened?
Diagnostic
Why did it happen?
Predictive
What will happen?
Prescriptive
What should we do?
Core formulas
Formula
Expression
Worked check
Bayes
P(A|B) = P(B|A) P(A) ÷ P(B)
Matrix product shape
(m × n)(n × p) = (m × p)
2 × 2 determinant
ad − bc
det 0 → no inverse
Gradient descent
w ← w − η × ∂L/∂w
η = learning rate
Min-max scaling
(x − min) ÷ (max − min)
x 30, range 10–50 → 0.5
Standardisation (z)
(x − mean) ÷ sd
x 70, mean 60, sd 5 → 2
Robust scaling
(x − median) ÷ IQR
Least outlier-sensitive
Euclidean distance
√Σ(xᵢ − yᵢ)²
(3, 4) to (6, 8) = 5
Manhattan distance
Σ|xᵢ − yᵢ|
(3, 4) to (6, 8) = 7
Entropy
−Σ pᵢ log₂ pᵢ
50/50 node = 1
Gini
1 − Σ pᵢ²
50/50 node = 0.5
Information gain
Parent entropy − weighted child entropy
SVM margin
2 ÷ ‖w‖
Larger C → narrower margin
AdaBoost weight
α = ½ ln((1 − e) ÷ e)
e = 0.2 → α ≈ 0.693
TF-IDF
tf × log(N ÷ df)
Term in every document → idf 0
PCA explained variance
eigenvalue ÷ sum of eigenvalues
Bootstrap coverage
1 − 1/e ≈ 63.2% distinct rows
36.8% out-of-bag
Confusion-matrix metrics
Worked on TP 40, FP 10, FN 20, TN 130 (200 rows).
Metric
Formula
Value
Accuracy
(TP + TN) ÷ total
0.85
Precision
TP ÷ (TP + FP)
0.80
Recall (sensitivity, TPR)
TP ÷ (TP + FN)
0.667
Specificity (TNR)
TN ÷ (TN + FP)
0.929
False positive rate
FP ÷ (FP + TN)
0.071
F1
2PR ÷ (P + R)
0.727
AUC = probability that a random positive is ranked above a random negative (0.5 = random guessing).
Neural network numbers
Item
Rule
Worked check
Conv output size
⌊(n + 2p − f) ÷ s⌋ + 1
32, f 5, p 0, s 1 → 28; p 2 → 32
Pooling output
Same formula, no weights, depth unchanged
28, 2 × 2, s 2 → 14
Conv output depth
Number of filters
Conv layer parameters
(f × f × channels + 1) × filters
3 × 3 × 3, 16 filters → 448
Dense parameters
inputs × outputs + outputs (biases)
784-128-10 → 101,770
Iterations per epoch
samples ÷ batch size
10,000 ÷ 100 = 100
Attention
softmax(QKᵀ ÷ √d_k) V
O(n²) in sequence length
Activation
Range
Typical use
Sigmoid
(0, 1); derivative peaks at 0.25
Binary output
Tanh
(−1, 1)
Zero-centred hidden layers
ReLU
[0, ∞)
Default hidden layer
Softmax
Outputs sum to 1
Single-label multi-class output
Linear
Any real
Regression output
Task
Output layer
Loss
Regression
Linear
MSE or MAE
Binary classification
Sigmoid
Binary cross-entropy
Multi-class, one label
Softmax
Categorical cross-entropy
Statistics for EDA
Fact
Value
Right (positive) skew
Mean > median (income)
Left skew
Mean < median
Empirical rule
~68%, 95%, 99.7% within 1, 2, 3 sd
Sample vs population sd
Divide by n − 1 vs n
Pearson vs Spearman
Linear vs any monotonic relationship
Big data and MLOps
Item
Fact
5 Vs
Volume, velocity, variety, veracity (quality), value
HDFS block
128 MB default (Hadoop 2.x, 3.x), replication 3
NameNode / DataNode
Metadata / blocks; Secondary NameNode is not a failover