Exercise 1: Tracing the Capstone's Own Code Back to Its Source Chapters — Possible Solution ==================================================================== TRACING EACH LINE TO ITS ORIGINATING CHAPTER ------------------------------ `x` arriving already tokenized and cleaned — nlp1-1's own preprocessing pipeline (tokenization, stopword removal, lemmatization) runs before this model ever sees the text. `nn.Embedding.from_pretrained(glove_vectors, freeze=True)` — nlp1-9's own frozen-embedding pattern, chosen specifically per that chapter's own guidance that small task-specific datasets should freeze pretrained vectors rather than risk degrading them through fine-tuning. `nn.LSTM(glove_vectors.shape[1], hidden_dim, batch_first=True)` — nlp1-6's own sequence-model architecture, the same mechanism from nn1-8 reused to process the embedded tokens one at a time, in order. `_, (hidden, _) = self.lstm(embedded)` followed by `self.output(hidden[-1])` — nlp1-6's own choice to read only the final hidden state, exactly the "one output for the whole sequence" pattern nlp1-7 later extended to per-token output. `torch.sigmoid(...)` — nlp1-6's own binary classifier head, appropriate here because sentiment is a two-class problem, contrasted with nlp1-7's own softmax-over-multiple-tags requirement for NER. WHY nlp1-2/nlp1-3 APPEAR IN THE ATTRIBUTION TABLE BUT NOT IN THE CODE ------------------------------ Per this chapter's own attribution table, bag-of-words (nlp1-2) and TF-IDF (nlp1-3) are credited as "early vectorization approaches, superseded in this pipeline per nlp1-4's own diagnosis." nlp1-4 proved, using a worked "dog bites man" vs. "man bites dog" example, that bag-of-words-style vectors are mathematically identical regardless of word order, and separately diagnosed that such vectors have no notion of word meaning at all (every word an isolated, unrelated dimension). Since this capstone's own pipeline needs both order-sensitivity (from nlp1-6's LSTM) and meaning-awareness (from nlp1-9's embeddings), using nlp1-2/nlp1-3's own representations as the input would have thrown away exactly the information the rest of the pipeline depends on. WHY THEY STILL EARN A PLACE IN THE ATTRIBUTION TABLE ------------------------------ Per this chapter, nlp1-2/nlp1-3 provided "the first real proof that text could be turned into numbers at all" — a genuine, necessary conceptual step even though the specific representation they produced doesn't survive into the final pipeline. Chapters can contribute foundational understanding to a course's own throughline without every one of their specific techniques appearing literally in the capstone's own code — the attribution table credits the idea's contribution, not just its surviving implementation. WHY THIS WORKS AS AN ANSWER ------------------------------ It traces each line of the capstone's own model back to the specific chapter responsible for it, and explains, using nlp1-4's own diagnosis, precisely why bag-of-words and TF-IDF were deliberately excluded from the final pipeline despite being credited as real, necessary steps in the course's own progression toward it.