Subject: Advanced Machine Learning — EAI 6103 / EAS 6103 (Semester I elective, DE-1) Attempt: Moodle quiz — 2 marks per question Stored: 19 November 2026 Questions captured so far: Q14, Q15
Verified against:
- source/EAI 6103-EAS 6103 Advanced Machine Learning -Assignment-4.pdf (official-style study notes, all 15 questions)
- Quiz screenshots for Q14 and Q15 (option letters below follow the on-screen order)
| Q | Topic | Answer (on-screen letter) |
|---|---|---|
| 14 | NLP — summation of a bag-of-words vector | d — may be zero |
| 15 | Pattern recognition — definition of generalization | a — approximates desired outputs for vectors not in the training set |
⚠️ Careful with
source/AML_Assignment_4_Consolidated_Questions_1_to_15.pdf. That version rewords Q14's options as "may be 1 / may be zero / All / may be 10" and keys it as C. All. The actual exam screen does not say that — it offers "always zero / always equal to 1 / always non-zero / may be zero", so "may be zero" is the only true option. Its Q15 key is right, only the option letters are shuffled. Use the official PDF + screenshots as the source of truth.
Question 14
Select correct answer:
- a. Summation of all the values of a document Bag of words vector is always zero
- b. Summation of all the values of a document Bag of words vector is always equal to 1
- c. Summation of all the values of a document Bag of words vector is always non-zero
- d. Summation of all the values of a document Bag of words vector may be zero
Answer: d) Summation of all the values of a document Bag of words vector may be zero
(In the study-notes PDF this same option appears as option c — the wording "may be zero" is what matters.)
Reasoning
A bag-of-words vector for one document is a count vector over the vocabulary:
bow[word] = number of occurrences of `word` in the document
so its summation equals the total number of in-vocabulary tokens in that document.
| Option | Verdict | Why |
|---|---|---|
| a. always zero | ✗ | A normal document has word counts, so the sum is positive (e.g. [2, 1, 0, 3] → 6). |
| b. always equal to 1 | ✗ | True only for an L1-normalized BoW (or a presence/TF vector), not for the raw count vector taught in the course. |
| c. always non-zero | ✗ | An empty document, or a document whose words are all stop-words / out-of-vocabulary, yields the all-zero vector [0, 0, …, 0] → sum = 0. |
| d. may be zero | ✓ | Counts are non-negative (sum ≥ 0) and can legitimately be 0; otherwise the sum is > 0. The only universally true statement. |
Key point: counts are non-negative, so the sum cannot be negative — but nothing forces it to be ≥ 1.
Course cross-reference — markdown/9. Basic NLP program.md builds the BoW with plain counts:
from collections import Counter
bow_simple = Counter(lower_tokens) # raw counts, un-normalized
bow = Counter(lemmatized) # after lemmatization
Because Counter values are occurrence counts, the vector sum = number of tokens, which is 0 for a document with no surviving tokens.
Rule of thumb for this family of questions
- Raw BoW / count vector → sum = document length (≥ 0, may be zero)
- Normalized BoW (L1) → sum = 1
- Binary BoW (presence) → sum = number of distinct vocabulary words present (may be zero)
Question 15
What is generalization?
- a. the ability of a pattern recognition system to approximate the desired output values for pattern vectors which are not in the training set.
- b. can be either way
- c. none
- d. the ability of a pattern recognition system to approximate the desired output values for pattern vectors which are not in the test set.
Answer: a) … for pattern vectors which are not in the training set
(Study-notes PDF labels this same sentence option c; letters are shuffled, wording is identical.)
Reasoning
- Generalization is the ability of a trained model to produce correct outputs for unseen data — data it was not trained on.
- Option (a) states exactly that: pattern vectors not in the training set. This is the standard textbook definition (Duda, Hart & Stork; Bishop; Mitchell) and matches the course slides where a network that "memorizes its training data … fails to generalize" on test data.
- Option (d) is the inverse trap: it excludes only the test set, i.e. it would include the training data. Correct performance on training data is memorization / fitting, not generalization — and the test set is precisely the stand-in for unseen data used to measure generalization.
- Option (b) "can be either way" and (c) "none" are filler — no definition supports them.
| Option | Verdict | Why |
|---|---|---|
| a. not in the training set | ✓ | Generalization = good performance on unseen (non-training) patterns. |
| b. can be either way | ✗ | A definition is not two-way. |
| c. none | ✗ | A correct definition exists. |
| d. not in the test set | ✗ | Excludes only test data, so it wrongly counts training-data performance as generalization. |
Related concepts to remember
- Overfitting → low training error, high test error → poor generalization
- Regularization / dropout / early stopping / more data / cross-validation → improve generalization
- Metrics: train vs validation/test gap; k-fold CV estimates generalization error
Course cross-reference — markdown/12 MLP.md: "A neural network has the tendency to memorize its training data … the network fails catastrophically when subjected to the test data. This is the classic case of the network failing to generalize."