02 Pre-processing - Cheat Sheet
Up: 02 Pre-processing - Index | 02 Pre-processing - Mind Map
Definitions
- Feature extractor: maps input to (feature name, value) pairs; Concept - Feature Extraction (s.5). Linear model: score , predict sign (s.8-9); Concept - Linear Model.
- Tokens vs types: = running words, = distinct words; normalization shrinks , not (s.23); Concept - Tokens and Types.
- Zipf’s law: few very frequent words, many rare ones (s.22); Concept - Zipf’s Law.
- Stemming = crude affix chopping, may give non-words (exampl); lemmatization = dictionary headword (am/are/is → be) (s.31-34); Concept - Stemming, Concept - Lemmatization, Concept - Morphology.
- Case folding: good for IR, bad for sentiment/IE (US vs us) (s.29); Concept - Case Folding.
- Sentence boundary: ? ! unambiguous, ”.” ambiguous (abbrev., numbers) (s.37-41); Concept - Sentence Boundary Detection.
- POS tagging labels words (Penn Treebank tags); parsing builds structure (constituency tree / Concept - Universal Dependencies) (s.42-56); Concept - Penn Treebank, Concept - Parsing.
- WSD / Lesk: pick the sense whose gloss overlaps the context most (s.49-51); Concept - Word Sense Disambiguation, Concept - Lesk Algorithm, Concept - WordNet, Concept - WordNet Relations.
- Bag of words: document × word matrix (presence / frequency / thresholded / tf-idf), ignores order (s.63-71); Concept - Bag of Words, Concept - Document-Term Matrix, Concept - Sparse Matrix (CSR), Concept - Multiword Features.
- Feature selection keeps a subset of columns; dimensionality reduction creates new combined features (s.173-174); Concept - Feature Selection, Concept - Dimensionality Reduction, Concept - Dictionary Reduction, Concept - Curse of Dimensionality.
- LSA = SVD of the doc-term matrix; handles synonymy/relatedness (s.190-191); Concept - Latent Semantic Analysis (LSA), Concept - Singular Value Decomposition (SVD), Concept - Truncated SVD, Concept - Non-negative Matrix Factorization (NMF), Concept - Synonymy and Semantic Relatedness.
Formulas
| Name | Formula |
|---|---|
| tf-idf (s.67) | , (Intro s.26 uses ) |
| Entropy (s.78) | ; max , min 0; |
| Information gain (s.81) | ; Humidity: |
| Cosine similarity (s.151, 172) | ; identical 1, disjoint 0, “Hello, World!” vs “Hello!” 0.71 |
| SVD (s.178, 183) | ; docs |
| Truncated SVD (s.188-192) | docs ; new doc ; rank |
Weather IG ranking (added context): Outlook 0.247 > Humidity 0.152 > Windy 0.048 > Temperature 0.029.
Key comparisons
| A | B |
|---|---|
| Stemming: rules, non-words, fast | Lemmatization: dictionary (+POS), valid words |
| Porter: milder | Lancaster: more aggressive (loving → lov) |
| Homonymy: unrelated meanings (bank) | Polysemy: related meanings (man) |
| Feature selection: subset of words | Dimensionality reduction: new combined features |
| Entropy: property of one set | IG: drop in entropy after a split |
| Cosine: angle only, length ignored | Euclidean-style length: not used |
Most likely exam questions
- Compare stemming and lemmatization with examples (s.31-34).
- Difficulties of tokenization and of sentence boundary detection (s.18-21, 37-41).
- Explain tf-idf and its intuition, as discussed in class (s.67-68).
- Pros and cons of bag of words (s.71): simple, effective, fast / no order, no semantics, high-dimensional and sparse.
- Describe feature selection by attribute ranking; compute entropy / information gain (s.74-88).
- State the cosine similarity formula and explain its symbols; why length does not matter (s.121, 142-150).
- How is dimensionality reduced in LSA; how is a new document mapped (s.185-192)? Why does doc 4 vs doc 5 similarity go from ~0 to 0.75?
- How does LSA address synonymy (s.191)?
Style guide: Past Exam - Question Bank & Style Guide.