text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
|D|/2 −log P(D | M)\n= minimising length of message needed to encode model + data (given\nthe model)\n\u0011 “Minimum Message Length (MML) Principle”\n31 / 55" }, { "id": "lecture-10-p032", "sourceId": "lecture-10", "lectureId": "lecture-10", "page": 32, "title": "32 / 55", "...
mlpc-exam
lib/data/slide-index.json
JSON
5a886d991cf525acfcb1ac7d7df9abcb7538fe778bdb60d21090a0afa5411d5a
261
896
\n\u0011 Model A is better than model B if code(MA + EA) < code(MB + EB)\n35 / 55" }, { "id": "lecture-10-p036", "sourceId": "lecture-10", "lectureId": "lecture-10", "page": 36, "title": "▶View a cluster model as a kind of probability distribution model for which we", "text":...
mlpc-exam
lib/data/slide-index.json
JSON
85fae726d886a6bccad6f83bf54471e5de9ca41276fbe238f48b3f28ddc86cf7
262
896
"bic", "the", "circular", "cluster", "unsupervised", "motivation", "statistical", "modelling" ], "retrievalText": "Unsupervised Learning. . Motivation\nClustering\nStatistical Data Modelling\nBIC and the Minimum Message Length Principle\nApplying the ...
mlpc-exam
lib/data/slide-index.json
JSON
7a162e8a5eedef673a4eb67148a857fb06f17c6a5ac85644043f6c487fb702ef
263
896
", "lectureId": "lecture-10", "page": 39, "title": "\u0011 Goal: Generative statistical model derived from the data", "text": "Motivation\nClustering\nStatistical Data Modelling\nTowards Statistical Data Modelling\nMotivation:\n▶Clustering algorithms (e.g., k-means) only describe association of ...
mlpc-exam
lib/data/slide-index.json
JSON
434b17931cf66873c0b330bee77827fb046557e85641f1b5ff9c54df7acf9092
264
896
probability of x under ith component distribution pi\n40 / 55" }, { "id": "lecture-10-p041", "sourceId": "lecture-10", "lectureId": "lecture-10", "page": 41, "title": "i=1", "text": "Motivation\nClustering\nStatistical Data Modelling\nStatistical Data Modelling via Mixture Mo...
mlpc-exam
lib/data/slide-index.json
JSON
08618cafcc76e7979ce63637fa2e16883b50c0d1066ab77361073744663ce19d
265
896
"components", "models", "gmms", "and", "unsupervised", "motivation" ], "retrievalText": "Unsupervised Learning. sum of k Gaussian distributions (“components”):. Motivation\nClustering\nStatistical Data Modelling\nGaussian Mixture Models (GMMs) and the E-M Algorithm\nG...
mlpc-exam
lib/data/slide-index.json
JSON
54d226a7531b2fc2793f83cd892036c9187124c6753912ddabbeaca4d6cf2708
266
896
the E-M Algorithm\nLearning GMMs from Data: How?\nIf we knew ...\n... which point ‘belongs to’ which component\n(i.e., which component generated each data point):\nCould easily fit model parameters by collecting all points belonging to each\ncomponent Ci and estimating wi, µi, Σi of the Gaussian Ci from these\n(see chap...
mlpc-exam
lib/data/slide-index.json
JSON
1bf15e9efae16f36a3171d68ac85f810eec4a4e00b5933eb8632ebddb2e34268
267
896
i = P\nj qijxj/qi\nΣi = P\nj qij(xj −µi)(xj −µi)T /qi\nwi = qi\n45 / 55", "keywords": [ "qij", "compute", "components", "the", "e-m", "algorithm", "parameters", "probabilistic", "assignment", "instances", "data", "gmms...
mlpc-exam
lib/data/slide-index.json
JSON
cc9b91171f9f41049892030c662105aa77741cf01c91150baaa0c9b63f6ec55f
268
896
, "clustering", "statistical", "data", "modelling", "gaussian", "mixture", "models", "and" ], "retrievalText": "Unsupervised Learning. 47 / 55. Motivation\nClustering\nStatistical Data Modelling\nGaussian Mixture Models (GMMs) and the E-M Algor...
mlpc-exam
lib/data/slide-index.json
JSON
d343d7958561de7aad525ed5a6fdf477aaf28771f1c11ce0d28bee8a3ca0a886
269
896
"page": 51, "title": "0", "text": "Motivation\nClustering\nStatistical Data Modelling\nGaussian Mixture Models (GMMs) and the E-M Algorithm\nProperties of the E-M Algorithm\nInterpretation of the E-M Steps:\n▶E (Expectation) Step: Can be interpreted as computing the expected value\nof the hidden indicator v...
mlpc-exam
lib/data/slide-index.json
JSON
7d236cf232c65e05aca1719e3018cdaabcb7d5424ac66c1942892c31bc81f8c2
270
896
cluster Ci)\nGMMs as Density Estimation:\n▶By construction, a GMM is a proper density function p(x) over feature space\n⇒can use it as a density estimator for p(x | ωi) for classification via Bayes’\nrule!\n▶GMM can generate (sample) new points that obey the same distribution\n▶Training algorithm estimates model paramet...
mlpc-exam
lib/data/slide-index.json
JSON
0d2f43491fd27167b3304483e7dfe37ac8c12f2efe5717b0a5d3815d164a31f8
271
896
terminate with k∗= 1 and select a degenerate 1-cluster solution\n▶it would select k∗= |D| and select a degenerate 1-example-per-cluster solution\n▶it would give the same result for all k and thus be useless for selecting among\ndifferent k\n▶it can only be computed for those k that are divisors of N = |D|\n▶it cannot b...
mlpc-exam
lib/data/slide-index.json
JSON
fe8ab497ec4889f2bb2988de064d4c383ca18060b4f5cde906ee98ba003bfc40
272
896
objects, we need to estimate\n▶1/10 the number of parameters\n▶the same number of parameters\n▶10 times as many parameters\n▶102 times as many parameters\n▶102 times as many plus 990 parameters.\n55 / 55", "keywords": [ "the", "cluster", "parameters", "many", "gmm", ...
mlpc-exam
lib/data/slide-index.json
JSON
09f9b9964faf9183ebdd9db05fefdf5320f327abd62d3c6462909c499c7104e6
273
451
# -*- coding: utf-8 -*- """Build the MLPC static study dataset from local PDFs. The question records are curated because Moodle PDF exports interleave useful exam content with attempt-review noise. Slide chunks are extracted directly so questions can be linked to lecture material and vectorized later. """ from __futu...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
3e06e4ab8b7d2735aed70e5c7dd4eef72662bd079f39e691f5fd4f87c05b5666
0
896
.37.39_3.jpeg", "closed-book-2026-group-b-page-05.jpeg", 5, "2026 closed-book exam image, Group B page 5", None), ("img-closed-book-2026-p06", "WhatsApp_Image_2026-06-15_at_13.37.39.jpeg", "closed-book-2026-group-b-page-06.jpeg", 6, "2026 closed-book exam image, Group B page 6", None), ("img-closed-book-2026-p0...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
95fb29a76a6b037987df1209ba383e7ded22d3b7154bbd55d6d03f7c37370a36
1
896
"lectureIds": ["lecture-05"], "description": "ID3, entropy, information gain, symbolic vs numeric splits, pruning, and tree depth.", }, { "id": "common-classifiers", "title": "Common Classifiers", "lectureIds": ["lecture-05"], "description": "Naive Bayes, SVMs, k-NN, deci...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
3d2bc0a6e8e6aa93fb40f45ae88c8fd755fdbd58c890e61a0c547d78742af08f
2
896
-Za-z0-9_-]{2,}", text.lower()) return [word for word in words if word not in STOPWORDS] def keywords(text: str, limit: int = 12) -> list[str]: counts = Counter(tokens(text)) return [word for word, _ in counts.most_common(limit)] def extract_slide_chunks(now: str) -> dict[str, Any]: chunks: list[dic...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
b2a411fbe926b67a5a0542649c0ac74baef98eadfbefd17918d254739f678283
3
896
in TOPIC_BY_ID[topic_id]["lectureIds"]: if lecture_id not in seen: seen.append(lecture_id) return seen def base_question( *, qid: str, origin: str, source_id: str, page: int | None, question_number: str | None, topic_ids: list[str], difficulty: str, ...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
fd8dd1cad4b52359398d9afcb20e413d5cbe5fc30ab0aed4ba1e6646092130e3
4
896
def add_multi( qid: str, source_id: str, page: int, qn: str, topic_ids: list[str], stem: str, choices: list[str], correct_indices: list[int], explanation: str, tags: list[str], *, origin: str = "real_exam", answer_source: str = "explicit_pdf", confidence: float = ...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
a0331ff38bd3944354e466cc2394d015e7167731e8a803ade7aa4f974aaa4671
5
896
-bayes-fish") add_tf("real-retake1-q002", "exam-retake-1", 1, "2", ["bayesian-classification"], f"{bayes_fish}\nFor any fish x in D, p(x) is a vector with 100 values.", False, "The feature vector x has 100 components, but p(x) is one scalar density or probability value.", ["bayes-rule", "feature-space"], group_id="...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
1860924f975c740c4efcf9e400b1d937d6594c438261e55ea7697951b00992fd
6
896
real-retake2-q009", "exam-retake-2", 1, "9", ["density-estimation"], f"{density_context}\nThe y values in the lower plot cannot be probabilities, because they are negative.", True, "Negative y-values cannot be probability values; the lower plot is not a probability/likelihood curve.", ["probability", "likelihood"], gro...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
a04c12f1ff4f58bd9af6935b865dd15c8d85b60af73ce6d53faeb574524e7f0e
7
896
False, "With k = N, each point is classified by the global majority vote, so minority-class training examples are misclassified.", ["knn", "resubstitution"], group_id="retake3-knn-k-equals-n") add_tf("real-retake3-q017", "exam-retake-3", 2, "17", ["nearest-neighbour"], f"{knn_context}\nThe resubstitution estimate o...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
3ba8c0bda7d2242f0aa0cec6832ed1da39f7d8b70f711c31261388c84c18f6bf
8
896
-q024", "exam-retake-5", 1, "24", ["common-classifiers"], f"{visual_dataset_context}\nAn SVM with a quadratic kernel can achieve an error of zero on this dataset.", True, "The quadratic feature mapping can make the dataset linearly separable in the transformed space.", ["svm", "kernel"], group_id="retake5-various-class...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
8e25f342d1c1413cba4d9358286cb4f819a431475d9615ef08fbf56661fa3857
9
896
, 3, "30", ["neural-networks", "classifier-evaluation"], f"{nn_threshold_context}\nIncreasing τ cannot increase the recall of the model on class 0 on the training set.", False, "Raising the threshold makes class 0 easier to predict, so recall for class 0 can increase.", ["threshold", "recall"], group_id="retake5-nn-thr...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
7f0d2e67c7463026eeecd04ef20bc3b3a097355670a416edadca270d034864af
10
896
"5 x 2", "In the lecture convention used by this exam, B has one row per observation symbol and one column per hidden state.", ["hmm", "observation-matrix"], answer_source="inferred_from_slides", confidence=0.88, group_id="retake6-hmm-dimensions") add_numeric("real-retake6-q038", "exam-retake-6", 1, "38", ["markov-...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
9f35ac00d863ad4d2c5f4e6c6dfd2223a416efb49582b64146c5ef466687190d
11
896
=0.94) add_short("real-ss20-q002", source, 2, "2", ["bayesian-classification"], "What will happen if the prior P(Ω) is very uneven, with a high value for one class and a low value for another?", "The classifier is biased toward the high-prior class; if the prior is strong enough, it can dominate the likelihood.", "...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
007cce12d93b9fcabc53b5f6ba481c428de1b086bec32441f8aa24121635e427
12
896
distance is scale-sensitive, so one feature can dominate after rescaling.", ["knn", "normalization"]) add_numeric("real-ss20-q011", source, 4, "11", ["decision-trees"], "For the one-dimensional training sequence + + - + + + - + - - -, what is the minimum depth of a binary-split decision tree on X that has zero trai...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
83e05e0f0182121c48d6fd75d301e3137d54aaca8d3f6596cf64ac40ceda6683
13
896
a dataset, A must have lower precision on ω1 than B.", False, "Recall and precision trade off often, but no strict implication holds for arbitrary classifiers.", ["precision", "recall"]) add_tf("real-ss20-q020", source, 7, "20", ["classifier-evaluation"], "No line segment of the ROC convex hull can be strictly hori...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
51ffce2170bf8714f7a0cac43af9b998ed29d41a3c2d8875865d9e35bf23ef7a
14
896
]) add_single("real-ss20-q029", source, 10, "30", ["neural-networks"], "When you add an additional hidden layer to a feed-forward network, how does that affect the variance of the network model?", ["it increases", "it decreases", "it is unchanged", "it becomes zero"], 0, "A more flexible model is more sensitive to ...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
004dd12736761ed920ed8b60a93bf2f17c24bf882b60f370aff9f2ac2593d74b
15
896
; " "S3 predict ω1 iff P(ω1|x) > P(ω2|x); " "S4 predict ω1 iff P(ω1) > 0.5; " "S5 predict ω1 iff p(x|ω1) > p(x); " "S6 predict ω1 iff P(ω1|x) > P(ω1)." ) options = ["S1", "S2", "S3", "S4", "S5", "S6"] add_multi("real-ss22-q001", source, 1, "1", ["bayesian-classification"], f"...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
174d10f71f39eb1e9d3a1d8c12575dcec09c46ee5a7e11ac2c61211778d80773
16
896
ss22-q009", source, 4, "9", ["bayesian-classification"], "If P(ω1|x) > P(ω1), then P(ω2|x) < P(ω2) in a two-class problem.", True, "The two posterior probabilities and the two priors each sum to one, so an increase for one class implies a decrease for the other.", ["posterior", "two-class"], group_id="ss22-bayes-condit...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
a2e0f04f8c4ed25a529547e7b2002fad6f1b0af1ebc4de377b001962fa4dfb61
17
896
x=1.", ["precision", "recall"], group_id="ss22-rp-space") add_single("real-ss22-q017", source, 7, "17", ["classifier-evaluation"], "In recall-precision space for class p, which point corresponds to an all-n classifier?", rp_choices, 5, "No positive predictions are made, so precision is undefined.", ["precision", "r...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
9858fa84e867fb9cce1e12c5360cd3c0af569f247ee3306418025585fb741e86
18
896
the classes perfectly.", ["tree-depth"], group_id="ss22-fish-dataset") add_tf("real-ss22-q025", source, 11, "25", ["decision-trees"], f"{fish_context}\nOn this dataset, ID3 is guaranteed to find the simplest possible tree.", True, "The feature with perfect information gain gives a depth-1 tree.", ["id3", "informati...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
8efe5b705cc95c73e9653aee415ca84bfc63b85eadd7b99c754e19b3db24f97e
19
896
class label is determined by Length, so a linear boundary separates x1=0 from x1=1.", ["linear-separability"], group_id="ss22-fish-linear") add_numeric("real-ss22-q033", source, 13, "33", ["neural-networks"], f"{fish_context}\nHow many units are needed to express a classifier without hidden layer that predicts P(ba...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
942ce519b88485a11b3bb62bbda1605b177cd79058fb91637406d67caf2dfdc4
20
896
44", ["neural-networks"], "In gradient descent, a gradient of zero will result in unchanged weights.", True, "The weight update is proportional to the negative gradient, so zero gradient gives no update.", ["gradient-descent"]) add_tf("real-ss22-q045", source, 18, "45", ["neural-networks"], "A large learning rate m...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
6c935d2371b7daeeadb507d2c3e3da81176352d2b2df760a979b7505889db1f6
21
896
"real-ss22-q056", source, 22, "56", ["unsupervised-learning"], "For k-means, what quality does Mean Quantisation Error (MQE) implicitly try to encode?", ["average size of cluster centers", "compactness of clusters", "average distance between cluster centers", "equal distribution among clusters", "number of clusters"], ...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
db19e86759a0149bb07187834302238aaef5a62056c966e71fbc0c8a7bfc3034
22
896
-matrix"]) add_tf("real-ss22-q065", source, 26, "65", ["markov-models-hmm"], "The HMM state transition matrix is always square.", True, "It maps states to states, so it has one row and one column per state.", ["hmm", "transition-matrix"]) add_tf("real-ss22-q066", source, 26, "66", ["markov-models-hmm"], "The Fo...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
81db4eb5e069f2a20922f1b1786f714458780c10f6e6be73a2617a8ae4e3fb35
23
896
.", ["bayes-error", "risk"]) add_tf("real-2023-q005", source, 2, "5", ["bayesian-classification"], f"{cost_context}\nThe expected risk defines decision boundaries only in a two-dimensional feature space.", False, "Risk-based decision boundaries exist in any feature-space dimension.", ["decision-boundary", "risk"]) ...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
7408e9c8b24a662f20761e20d66d074c1300db7cf7f9e1fbd68251d9a18c7ae0
24
896
C,D) = 1.0.", False, "Recall and precision are independent measures and do not generally sum to one.", ["precision", "recall"], answer_source="explicit_pdf") add_tf("real-2023-q012", source, 5, "12", ["classifier-evaluation"], "If two classifiers have the same TPRs but different FPRs, they cannot have the same accu...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
6334c491576dbc996a366b21d66603be0e52ce1d6e4fdf7036f68c9e5bf3ec8b
25
896
id3s_context}\nThis is a high-bias learner.", True, "Restricting trees to one split severely limits expressiveness.", ["bias", "id3"], answer_source="explicit_pdf") add_tf("real-2023-q020", source, 8, "20", ["common-classifiers", "decision-trees"], f"{id3s_context}\nCombining different such trees via voting can imp...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
d3f7548e1942aa10603f9999bfa14b0c34fce52ff0691bf7976222c6010c9ff9
26
896
number of hidden layers.", ["cross-entropy"], answer_source="explicit_pdf") add_tf("real-2023-q028", source, 11, "28", ["neural-networks"], f"{ce_context}\nIf the class distribution is 50:50, binary cross-entropy encourages predictions close to 0.5.", False, "Cross-entropy encourages confident correct predictions f...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
b5699f91aa269229aaf1122fd37f4c2e4d38e2e001dd202e8343f150ab23104b
27
896
1/3]." add_tf("real-2023-q036", source, 14, "36", ["markov-models-hmm"], f"{markov_context}\nIf some a_ij is changed to zero, then a_ji must also be zero for a valid Markov process.", False, "Transition probabilities need not be symmetric.", ["markov-chain", "transition-matrix"], answer_source="inferred_from_slides...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
1ff1dabaf9e01bb9162c20c64be9b64980fdc898663439e078bdbdb1aab8958a
28
896
)", "P(S|M_A)", "P(B)"], [0, 1, 3, 4], "MAP compares P(S|M_A)P(A) with P(S|M_B)P(B).", ["map", "markov-model", "likelihood"], answer_source="inferred_from_slides", confidence=0.94) add_tf("real-2023-q044", source, 16, "44", ["markov-models-hmm"], "If S2 is produced by concatenating two copies of S, the likelihoods ...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
3de4ee3167e666cae1e663c903b0e0569af9978b1475317181bc25574ae7c52b
29
896
likelihood of data under parameters; posterior maximization would be MAP estimation.", ["mle", "likelihood"], "definition"), ("gen-density-002", ["density-estimation"], "A likelihood value for continuous data can be greater than 1.", True, "Continuous probability densities can exceed 1; probabilities over regio...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
28c5d47f487a7c2c75083ff216f1683ce5afb875b5863735e40dcabb7e4c132e
30
896
", ["bagging", "ensemble"], "definition"), ("gen-improve-001", ["learning-improvement"], "Feature construction can make a classifier succeed even when the original feature space is not linearly separable.", True, "A transformed feature space can expose a simpler decision boundary.", ["feature-construction", "li...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
a7d423de9d329991e50691766375c35e64fd138d0d3aa504807ab282d35cb6bf
31
896
centers.", ["k-means", "mqe"], "definition"), ("gen-unsup-002", ["unsupervised-learning"], "Increasing k in k-means always improves the BIC score.", False, "BIC balances fit with a complexity penalty, so more clusters are not always preferred.", ["bic", "k-means"], "conceptual"), ("gen-unsup-003", ["uns...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
6b0676c1558071bbdc6fec521a478bada329cb61eb41bc845194a57a368e496b
32
896
bic", "model-selection"], origin="generated_from_slides", answer_source="generated", ) def attach_retrieval_text_and_slide_refs(slide_index: dict[str, Any]) -> None: chunks = slide_index["chunks"] by_lecture: dict[str, list[dict[str, Any]]] = {} for chunk in chunks: by_lecture....
mlpc-exam
scripts/build-mlpc-dataset.py
Python
3361eb5394d2205a5cb490f1d275fb742bc7d7e2d64247b6d9cf36317329b4d8
33
896
, tags: list[str], *, difficulty: str = "medium", cognitive_level: str = "conceptual", confidence: float = 0.96, group_id: str | None = None, ) -> None: add_single( qid, f"img-closed-book-2026-p{page:02d}", page, qn, topic_ids, stem, ch...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
0a7e42f8301379269999ab73068a54e4c8002ada30bc6236c0a8945f01394425
34
896
class." ) percent_choices = ["0%", "5%", "10%", "50%", "80%", "90%", "95%", "100%", "other"] img_single("img-q001", 2, "1", ["classifier-evaluation"], f"{metric_context}\nWhat is the expected accuracy that T2 will achieve on the population of A?", percent_choices, 5, "T2 always predicts false, so it is corr...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
5f476679be75d018d80cf2f465959707a67ba5a23a319ded4b65a42db8300de2
35
896
.", ["cost-matrix", "risk"], cognitive_level="calculation", group_id="img-cost-decisions") img_single("img-q008", 3, "8", ["bayesian-classification", "classifier-evaluation"], f"{cost_context}\nλ = [[0, 100], [100, 0]]", test_choices, 1, "Both error types are equally expensive, so the lowest expected error rate sti...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
5bacced81f67e489630875466fee35154838653408b6439c02e545ba5018d2eb
36
896
", ["bayesian-classification"], "Not normalising by p(x) in a Bayesian MAP classifier tends to reduce its ability to overfit data.", False, "Dropping p(x) does not change MAP predictions because p(x) is constant across classes for a fixed x.", ["map", "evidence"], group_id="img-overfitting") img_tf("img-q018", 5, "...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
d1b70cc2c16db668309a3d605e8646755d23caf0dab9d621ebad35616445e83b
37
896
, "Gradient-based learning needs derivatives to compute weight updates.", ["loss", "differentiability"], group_id="img-ann") img_single("img-q026", 6, "26", ["neural-networks"], "Binary cross-entropy is ...", ["a measure of difference between two binary class distributions", "a measure of influence between two bina...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
33d0dbf93c4e20e66b0e67b28048b3e7a4f0e853699730a21be0de0fe54235bf
38
896
-q032", 7, "32", ["neural-networks"], "In early stopping, we stop training an ANN ...", ["when the training error reaches zero", "when the validation error reaches zero", "when the training error goes above the validation error", "when the validation error starts going up", "when the validation error reaches the traini...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
aae2322d65dd7e39a6fbc650edd6454a4d1c764cf7e5f2b3452a75dfe28f5bcb
39
896
, "In an ID3 tree, no leaf can contain training examples of different classes", "If two training examples have the same feature values but different class labels, no decision tree can be 100% consistent with the training data", "There can be no dataset for which a consistent decision tree consists only of a root node",...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
470ddfef21fc75a879f3f4af93c30219b370e0930a25ba984db0faa026baad67
40
896
"kN + d parameters"], 0, "Each component needs a mean vector, covariance parameters, and a mixture weight.", ["gmm", "parameters"], cognitive_level="calculation", group_id="img-unsupervised") img_single("img-q043", 10, "43", ["unsupervised-learning"], "In clustering, the Bayes Information Criterion (BIC) is used .....
mlpc-exam
scripts/build-mlpc-dataset.py
Python
34eb0813189919e6495b0f737828370de457e01e0aab3fced9491e8926c1da62
41
896
"k(d+1) parameters", "kN + d parameters", "kd^2 parameters", "kd parameters"], 6, "A k-means model stores k cluster centers, each with d coordinates.", ["k-means", "parameters"], cognitive_level="calculation", group_id="img-unsupervised") def build_legacy_approved_questions() -> None: legacy_tf("legacy-q001", "ex...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
ec10637f05c5af16a08972665f8451fbbf9ce15aae7ffdcfcfd3c09a968ed996
42
896
normalization"]) legacy_single("legacy-q011", "exam-ss20", 10, "29", ["neural-networks"], "Adding an additional hidden layer to a feed-forward network generally affects model bias how?", ["it increases", "it decreases", "it is unchanged", "it becomes undefined"], 1, "More expressive models generally have lower bias...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
9875e48fff97433054b23e09ce2e94900e2444bcae9078534c812423f86ed34a
43
896
(θ|D)", "p(D|θ)", "P(ω|x)", "the prior P(θ) only"], 1, "MLE maximizes the likelihood of the observed data under the parameter.", ["mle"]) gen_tf("gen-closed-q007", ["density-estimation"], "For continuous variables, a probability density value can be larger than 1.", True, "Densities can exceed one; integrals over r...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
215f775802c09b1aeed1939f0de709b350b229ed14d71e036537ca1d37c2b0f0
44
896
]) gen_single("gen-closed-q018", ["nearest-neighbour"], "Why can feature normalization matter for k-NN?", ["It changes class priors", "It changes Euclidean distances", "It changes the number of examples", "It makes k irrelevant"], 1, "k-NN bases predictions on distances.", ["knn", "normalization"]) gen_tf("gen-...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
912452fb4cb87c2f477e6bd87c9c101f321bfa7666c5e231741f3dcde351160a
45
896
, "The negative gradient is the local steepest descent direction.", ["gradient-descent"]) gen_tf("gen-closed-q029", ["neural-networks"], "A learning rate that is too large can overshoot good parameter values.", True, "Large updates can bounce across or diverge from minima.", ["learning-rate"]) gen_single("gen-c...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
e52c28fbbf9fbacbee9c8d3120fbeec7d29abd114eb1ef8dcc10ec79e5b106d7
46
896
q040", ["markov-models-hmm"], "The Forward algorithm is used to compute ...", ["the probability of an observation sequence", "the number of clusters", "the information gain of a feature", "the SVM margin"], 0, "It marginalizes over hidden state paths.", ["forward-algorithm"]) def main() -> None: DATA_DIR.mkdir(pa...
mlpc-exam
scripts/build-mlpc-dataset.py
Python
1b6cb31dc3e585f34bbd4becc1cb3240dab0d81a143af240cf1735c24fc996cb
47
596
# Python __pycache__/ *.py[cod] *.pyo .pytest_cache/ pytest_tmp/ .mypy_cache/ .ruff_cache/ .coverage htmlcov/ # Virtual environments and local config .venv/ venv/ env/ .env .env.* # Course dataset and raw audio data/ resources/*.zip resources_codex/ *.wav *.flac *.mp3 # Large generated artifacts results/*.npz result...
mlpc_task_4
.gitignore
Git Ignore
9bc2f8ffc81cc0b9b188bba0c6e51556987d199b6963bd72da249a6f730b82d7
0
207
[tool.ruff] line-length = 100 target-version = "py311" [tool.ruff.lint] select = ["E", "F", "I", "UP", "B"] ignore = ["E501"] [tool.pytest.ini_options] testpaths = ["tests"] filterwarnings = [ "ignore:Stochastic Optimizer:sklearn.exceptions.ConvergenceWarning", ]
mlpc_task_4
pyproject.toml
TOML
c91bdbb96080c4057d4d5799fbcb19570570cb0c045be97f6c94565b9a2df4c0
0
85
# MLPC 2026 Task 4: Data Classification This repository contains the code, report, slides, and tracked result summaries for the MLPC 2026 Task 4 sound event classification assignment. ## Contents - `src/` - data preparation, splits, preprocessing, training, evaluation, and report figures - `tests/` - unit tests for ...
mlpc_task_4
README.md
Markdown
23fb6bbfb6fd59099ed980a089bd7348104fc1e5cfcab0ff3fe6f2ed2a08be9b
0
424
numpy>=1.26 pandas>=2.1 scikit-learn>=1.4 matplotlib>=3.8 seaborn>=0.13 tqdm>=4.66 mlx>=0.18; sys_platform == "darwin" and platform_machine == "arm64" librosa>=0.10 soundfile>=0.12 pyarrow>=15 joblib>=1.3 pytest>=8.0
mlpc_task_4
requirements.txt
Text
7eca92e1d6acf09d6a3fb26b1474f7c7bd70f4e0ab3fea1a5e4076ce78a272a2
0
64
\documentclass{article} \usepackage[final]{neurips_2023} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{hyperref} \usepackage{url} \usepackage{booktabs} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{nicefrac} \usepackage{microtype} \usepackage{xcolor} \usepackage{graphicx} \usepackage{subca...
mlpc_task_4
report/main.tex
TeX
2d4030696e7b783c29df99a727b8c201b5b00ffe10a557646f23c8a22d693c24
0
896
The split is collector-disjoint, not segment- or file-random. We use grouped random splitting with 70\%/15\%/15\% target proportions, yielding 116{,}950 train segments from 2{,}553 files and 285 collectors, 25{,}733 validation segments from 548 files and 61 collectors, and 25{,}556 test segments from 555 files and 62 c...
mlpc_task_4
report/main.tex
TeX
021a70ce143a042a98579d952e6dd52ed2688f034123aaf8511c459f8c031910
1
896
^{-4}$ and positive weights clipped at 10. Stronger class weighting improved rare-class recall but lowered ranking quality on common classes; no weighting improved micro AP but hurt macro AP. % NOTE: Figure 2 (validation-AP settings bar charts, figures/hyperparameter_summary.pdf) was % removed to meet the 3-page limit;...
mlpc_task_4
report/main.tex
TeX
6d847ca1c2485a8d0a2940128bb98bf85b443497457dcf83ef88a1db78e3ba7e
2
896
{running\_water} (0.925 AP), \texttt{keyboard\_typing} (0.861), \texttt{vacuum\_cleaner} (0.847), and \texttt{microwave} (0.793). These produce long, repeated evidence across adjacent segments, so the context window and AP-based objective work well. The weakest classes are \texttt{light\_switch} (0.108), \texttt{wardro...
mlpc_task_4
report/main.tex
TeX
74f9a229f413a26faa65245ad4682197592f4e96f7934a89df305a54f7a52ee8
3
378
{ "test": { "macro_ap": 0.06358323991298676, "micro_ap": 0.12071314403081619, "per_class_ap": { "bell_ringing": 0.018077947199344635, "coffee_machine": 0.03588198497891426, "cutlery_dishes": 0.07446391880512238, "door_open_close": 0.05137736722826958, "footsteps": 0.155697286...
mlpc_task_4
results/baseline.json
JSON
35273f27b83ec83f36be4d0133573ddd27fe733195f0a94b7160ca9541413015
0
613
# Results Log ## Dataset Cache - Files processed: 3656 - Total segments: 168239 - Feature dimensionality: 960 - Feature keys: bandwidth_max, bandwidth_mean, bandwidth_min, bandwidth_std, centroid_max, centroid_mean, centroid_min, centroid_std, contrast_max, contrast_mean, contrast_min, contrast_std, energy_max, energ...
mlpc_task_4
results/log.md
Markdown
dabfad3fed53baca6655504cbeab4118811fb6f5c1711a471b1227f98b305711
0
316
{ "macro_ap": 0.617816150188446, "micro_ap": 0.7172471440304844, "members": [ "C:\\Development\\Private\\mlpc_task_4\\results\\mlp_refine_candidates\\mlp_01_512-256_d0.45_lr0.001_s42.pt", "C:\\Development\\Private\\mlpc_task_4\\results\\mlp_refine_candidates\\mlp_02_1024-512_d0.35_lr0.001_s42.pt", "C:...
mlpc_task_4
results/mlp_ensemble_manifest.json
JSON
8ce2c2c15deaa207a867841f5a04f0f50f22035b73935cc1f7a70a0e187cbf73
0
291
% !TeX program = xelatex % !TeX encoding = UTF-8 % !TeX spellcheck = en_US %% %% MLPC 2026 Task 4 -- Case Study and Reflection %% Restyled with the official JKU LaTeX Beamer theme %% (https://github.com/michaelroland/jku-templates-presentation-latex) %% %% BUILD: compile with XeLaTeX (or LuaLaTeX) so the JKU corporat...
mlpc_task_4
slides/slides.tex
TeX
9971d1a10e759a0fe149d77d6eb8e3f317392a7a159fb409e15db9e2dcb5e224
0
896
------------------------------------------ \begin{frame}{Qualitative Case Studies} \begin{columns}[T] \begin{column}{0.49\textwidth} \textbf{Success: file 000727} \begin{itemize} \item Kitchen (microwave, water, dishes); static phone \item File-level F1: \textbf{0.978} \item Su...
mlpc_task_4
slides/slides.tex
TeX
cfe40bf23ff3cf8b6104300b257fc326aacee0c96e12e7f514111ce261d4aadc
1
896
{Mechanical confusions:} \texttt{door}, \texttt{window}, and \texttt{wardrobe\_drawer} share impact, hinge, and handling sounds; the feature representation separates them only weakly. \vspace{0.35em} \item \textbf{Rare-class instability:} Few positive examples make AP sensitive to label noise and misse...
mlpc_task_4
slides/slides.tex
TeX
ed9f8cb7aa6801d1254a733392ab6f9866c2fd5c9947ea76907256f2f04741c1
2
137
"""MLPC 2026 Task 4 classification pipeline."""
mlpc_task_4
src/__init__.py
Python
80ac7cd492d41224ef634f7f31967ee7d6c0d76156b5ee8e253f02e07776f6f6
0
13
from __future__ import annotations import json from pathlib import Path from typing import Any import numpy as np from . import config from .metrics import macro_ap, micro_ap, per_class_ap, per_class_f1_at_optimal from .splits import load_dataset_cache def class_prior_baseline_scores(y_train: np.ndarray, n_rows: i...
mlpc_task_4
src/baseline.py
Python
418d03a04dd1231a48fd069a9fd8f67b0e245d2482c16309c7d8c24e27a3d2ff
0
583
from pathlib import Path ROOT = Path(__file__).resolve().parents[1] DATA_DIR = ROOT / "data" FEATURES_DIR = DATA_DIR / "audio_features" METADATA_CSV = DATA_DIR / "metadata.csv" ANNOTATIONS_CSV = DATA_DIR / "annotations.csv" RESULTS_DIR = ROOT / "results" FIG_DIR = RESULTS_DIR / "figures" DATASET_CACHE = RESULTS_DIR /...
mlpc_task_4
src/config.py
Python
035e853f9f031cb613fe902537bc41ad8c06a0a9735b231019fe3c685f28400c
0
413
from __future__ import annotations from collections.abc import Mapping from pathlib import Path from typing import Any import numpy as np import pandas as pd from . import config NON_FEATURE_KEYS = { "annotations", "annotation", "class_names", "annotator_ids", "annotators", "start_time", ...
mlpc_task_4
src/data.py
Python
52e47f5613e5a59f40c7dd3c3f3938f7b2401cbd6c1e53c2cdaf5ef37db1ff5e
0
896
: tuple[str, ...], segment_count: int ) -> np.ndarray: for key in keys: if key in npz_dict: arr = np.asarray(npz_dict[key], dtype=np.float32) if arr.shape[0] != segment_count: raise ValueError( f"{key!r} has segment count {arr.shape[0]}, expected {...
mlpc_task_4
src/data.py
Python
057fdc9acfa27903081d9c4217e779c3bb7a129342279d9712f5352990182d19
1
896
ValueError(f"Class names in {feature_file} do not match config.CLASS_NAMES") if "annotations" not in npz_dict: raise ValueError(f"{feature_file} does not contain an 'annotations' array") features, feature_keys = concat_features(npz_dict) labels = aggregate_labels(np.asarray(npz_dict...
mlpc_task_4
src/data.py
Python
b21863b1961f0a1c3e0a5b8f18130fd1dacb42dfa292227f9ef4784fc807756e
2
620
"""Build a validation-selected ensemble from saved MLP checkpoints. This is intentionally simple: score available checkpoints, average probability outputs, and keep the ensemble only if validation macro AP improves over the best single MLP. The final report uses the resulting predictions. """ from __future__ import ...
mlpc_task_4
src/ensemble_mlp.py
Python
02e7e983a027f3273db733a9ee88d68a2b3eec84e5c22c8220e60a04dd6d4a13
0
896
candidate in candidates], axis=0).astype(np.float32) return val_scores, test_scores, macro_ap(y_val, val_scores), micro_ap(y_val, val_scores) def _search_ensembles( candidates: list[CandidateScores], y_val: np.ndarray, max_pool: int = 14, ) -> tuple[list[dict[str, Any]], list[CandidateScores], np.ndar...
mlpc_task_4
src/ensemble_mlp.py
Python
3bb04f9729eeffa96e2a577ff8f8e075897b3adcc20cc092273dc9f4b73610ff
1
896
"mlp_val_scores"]) def _update_predictions( val_scores: np.ndarray, test_scores: np.ndarray, y_val: np.ndarray, y_test: np.ndarray, val_idx: np.ndarray, test_idx: np.ndarray, class_names: np.ndarray, ) -> None: existing: dict[str, np.ndarray] = {} if config.PREDICTIONS_TEST.exists(...
mlpc_task_4
src/ensemble_mlp.py
Python
47baf3e462c2f49b612b3f3a85640487f6d9c1e725d8a1e072998853308e6ce8
2
684
from __future__ import annotations import json from pathlib import Path from typing import Any import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pandas as pd from . import config from .metrics import macro_ap, micro_ap, per_class_ap def _metric_row( name: str, ...
mlpc_task_4
src/final_eval.py
Python
d01e76d1d17e47c0dbf743ed556d4ecce019c4b6de0ea7521dcac76422c2f530
0
896
asarray(file_ids).astype(str) == str(file_id) if not mask.any(): raise ValueError(f"file_id {file_id!r} not found") truth = np.asarray(y_true)[mask].T score = np.asarray(y_score)[mask].T x = np.asarray(times)[mask] if times is not None else np.arange(score.shape[1]) output = ( Path...
mlpc_task_4
src/final_eval.py
Python
bf2f46500e578f8609d198cb258426db5fd7fe35e46f1e56ac0e5443339b36a3
1
580
from __future__ import annotations import numpy as np from sklearn.metrics import average_precision_score, f1_score def _validate_targets(y_true: np.ndarray, y_score: np.ndarray) -> tuple[np.ndarray, np.ndarray]: true = np.asarray(y_true) score = np.asarray(y_score, dtype=np.float32) if true.shape != sco...
mlpc_task_4
src/metrics.py
Python
52c58fe8f6c847166f2ca74e7ecff2f4e7a9240a691611a9f03aca52ea9e022b
0
666
from __future__ import annotations from collections.abc import Mapping from pathlib import Path import joblib import numpy as np from sklearn.preprocessing import StandardScaler from . import config from .splits import load_dataset_cache def fit_scaler(x_train: np.ndarray) -> StandardScaler: scaler = StandardS...
mlpc_task_4
src/preprocess.py
Python
dfa029cb90a0f1e552019060cef3c9b2bc9ddefa7afded4392772953a47da783
0
896
else: if file_order is None: raise ValueError("file_order is required when per_file_iou is an array") values = np.asarray(per_file_iou, dtype=np.float32) lookup = {str(file_id): float(values[i, class_idx]) for i, file_id in enumerate(file_order)} return np.asarray( [ ...
mlpc_task_4
src/preprocess.py
Python
ab8de4ea7b133bf117dd3a72a176db0a6bc6254bd1b9728f5658569db2086028
1
388
"""Focused CUDA logistic-regression sweep used for the final report. The standard sklearn one-vs-rest model is kept in ``train_lr.py``. This module is an optional experiment runner: it trains a linear sigmoid head with PyTorch so the same temporal-context features and class-weighted BCE setup can be compared against ...
mlpc_task_4
src/refine_lr_torch.py
Python
df7fde681308178dc44d63ef66f8400ac3ade6b4868ae883b0db34a92ada05ea
0
896
.read_csv(path) if frame.empty or "macro_ap" not in frame: return -np.inf return float(frame["macro_ap"].max()) def _predict_proba(model: TorchLogisticRegression, features: np.ndarray, batch_size: int = 16384) -> np.ndarray: model.eval() device = next(model.parameters()).device x = np.asar...
mlpc_task_4
src/refine_lr_torch.py
Python
5cdd04c5d0877b93b9c3f6d700b0a49bfa47e1cffffdf9503645ab8d01937775
1
896
(np.mean(losses)), "val_macro_ap": val_macro} ) if val_macro > best_macro: best_macro = val_macro best_scores = val_scores best_state = { key: value.detach().cpu().clone() for key, value in model.state_dict().items() } bad_epoch...
mlpc_task_4
src/refine_lr_torch.py
Python
fade8811df006b27da6a6bce6daa279c93e89cf4a28674662648a57876c90411
2
896
None rows: list[dict[str, Any]] = [] candidate_dir = config.RESULTS_DIR / "lr_refine_candidates" candidate_dir.mkdir(parents=True, exist_ok=True) print(f"incumbent_lr_val_macro={incumbent:.6f}") start = time.time() for run_idx, params in enumerate(CANDIDATES, start=1): feature_key = str...
mlpc_task_4
src/refine_lr_torch.py
Python
baf73dd1246a096a60af2006584f5849bf98e41c27d51f0c3a10eb38f1642afc
3
680
"""Focused MLP refinement sweep used after the broad baseline sweep. The broad, reusable MLP trainer lives in ``train_mlp.py``. This module keeps the small hand-selected refinement grid that was run for the submitted Task 4 results and promotes a candidate only when validation macro AP improves. """ from __future__ ...
mlpc_task_4
src/refine_mlp.py
Python
3a69bac61d62421845a977013451d3ac295bbb4b58288eba2626ec36938c5e69
0
896
": float(metrics["runtime_s"]), "epochs": int(metrics["epochs"]), } row.update( { f"ap_{name}": float(value) for name, value in zip(class_names, per_class_ap(y_true, y_score), strict=True) } ) return row def _merge_sweeps(refine_frame: pd.DataFrame) -> N...
mlpc_task_4
src/refine_mlp.py
Python
a469d4aec35cab51bed3cc190922d1d3cd644655ecb12f8591028bd69bd0446e
1
896
seed"], model_path=candidate_path, ) rows.append(_row(params, metrics, y[val_idx], val_scores, class_names)) print( f" val_macro={metrics['macro_ap']:.6f} " f"val_micro={metrics['micro_ap']:.6f} epochs={metrics['epochs']} " f"runtime_s={metrics['r...
mlpc_task_4
src/refine_mlp.py
Python
6178cd6a6e7216964a6b362a8dc0a6cf761760d5af89b290d9bd51ef6e2c8857
2
439
"""Generate report figures from result summaries and cached predictions.""" from __future__ import annotations import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pandas as pd from . import config from .final_eval import _file_f1 REPORT_FIG_DIR = config.ROOT / "report...
mlpc_task_4
src/report_assets.py
Python
8428f757e06d4d6cd8793ced8eedd438b5c48402c901128cc57c317ec9ead375
0
896
.close(fig) def make_per_class_ap_figure() -> None: REPORT_FIG_DIR.mkdir(parents=True, exist_ok=True) frame = pd.read_csv(config.FINAL_TABLE_CSV) classes = [col[3:] for col in frame.columns if col.startswith("ap_")] mlp = frame[frame["model"] == "mlp"].iloc[0] order = sorted(classes, key=lambda na...
mlpc_task_4
src/report_assets.py
Python
1f09b8ac0e3afb405086d187d9ac14d72e9565bbb4ea77b622caaef12dfd9ceb
1
896
[:7] labels = [_short_label(str(class_names[idx])) for idx in active] axes[0].imshow(mel.T, origin="lower", aspect="auto", cmap="magma") axes[0].set_title(title, fontsize=10) axes[0].set_ylabel("mel bin") axes[0].set_xticks([]) axes[1].imshow(y_file[:, active].T, origin="lower", aspect="auto",...
mlpc_task_4
src/report_assets.py
Python
71454b94ef4c0a5e1b7c02856f1add59af2eb624bb9c7d9e39c7aaa153127f00
2
764
from __future__ import annotations import argparse from pathlib import Path import pandas as pd from .final_eval import run_final_evaluation from .train_lr import plot_lr_sweep, sweep_lr from .train_mlp import sweep_mlp MLP_GRID = { "hidden_dims": [ [128], [256], [512], [256, 128...
mlpc_task_4
src/run_best_sweeps.py
Python
030b4688896f1db3ac22cd2c426161e7be981b9b44d5e6282de535e834935139
0
549