session: "6103-advanced-ml/2026-10-17 0925 Advance Machine Learning"
title: "Advance Machine Learning"
date: "2026-10-17 09:25"
duration: "--"
language: "en"
model: "deepseek-ai/DeepSeek-V3.2"
parts: 3
transcript_chars: 56636
generated: "2026-11-23T00:36:19+05:30"
Advanced Machine Learning
Overview
This class introduced foundational concepts in Natural Language Processing (NLP), focusing on text data preprocessing. It covered the importance of transforming raw text into a standardized format for machine learning models. Key techniques discussed included tokenization, stemming, and lemmatization, along with their practical trade-offs. The session also touched on subsequent steps like stop word removal and Named Entity Recognition (NER), positioning text normalization as a critical first step in the NLP pipeline before applying models like CNNs or Transformers.
Learning outcomes
- Explain the purpose and steps of text preprocessing in NLP.
- Differentiate between stemming and lemmatization, including their advantages and disadvantages.
- Implement basic text normalization (tokenization, stemming, lemmatization) using libraries like NLTK.
- Describe how part-of-speech (POS) information affects lemmatization accuracy.
- Outline a standard NLP pipeline from raw text to a bag-of-words representation.
Core concepts
Natural Language Processing (NLP)
A field of AI dealing with the interaction between computers and human language, specifically text data. It matters because most real-world data exists in textual form, and preprocessing is essential to make this data usable for machine learning models.
Text Normalization
A set of techniques to transform text data into a consistent, canonical form. It is a part of data transformation and matters because it reduces vocabulary size and improves model consistency by grouping similar words (e.g., "running", "ran", "runs" → "run").
Tokenization
The process of splitting a text into individual words or sentences. It is the first preprocessing technique and matters because it converts continuous text into discrete units (tokens) that can be processed by algorithms.
Stemming
A normalization technique that removes prefixes and suffixes using rules or heuristics to arrive at a root form (stem). It is fast and computationally lightweight but may produce non-valid words. It connects to lemmatization as a faster but less accurate alternative.
Lemmatization
A normalization technique that uses vocabulary and morphological analysis to find the dictionary base form (lemma) of a word. It considers part of speech and linguistic context, making it more precise but slower than stemming. It connects to the need for accurate word representation in downstream tasks.
Stop Word Removal
The process of filtering out common, low-information words (e.g., "the", "is", "to"). It matters because it reduces noise and data dimensionality, focusing the model on meaningful words.
Named Entity Recognition (NER)
Identifies and classifies named entities (e.g., persons, locations, organizations) in text. It matters for extracting structured information from unstructured text and connects to POS tagging.
Bag-of-Words (B-O-W)
A text representation model that counts word frequencies in a document after preprocessing. It matters as a simple, foundational method for converting text into numerical vectors for machine learning models.
Formulas and maths
(No explicit formulas or equations were presented in this part.)
Worked examples
Normalization Example
Words like "connected," "connecting," "connection" are normalized to the root word "connect."
Stemming Examples (using Porter Stemmer)
- Input:
["kates", "travel", "traveled", "traveling"] - Output:
["kate", "travel", "travel", "travel"] - "studies" might be stemmed to "studi".
- "connected" becomes "connect".
- "relational" becomes "relat".
Lemmatization Examples
- Without POS: Sentence "he was running and eating at the same time" → lemmatized tokens
["he", "wa", "running", "and", "eating", "at", "the", "same", "time"] (inaccurate for "was" → "wa"). - With POS specified as verb: "he was running and eating" →
["he", "be", "run", "and", "eat"]. - "studies" becomes "study".
- "better" becomes "good".
Tokenization Example
- Sentence: "ram gives book to sita"
- Tokens:
["ram", "gives", "book", "to", "sita"]
Stop Word Removal & Processing Pipeline Example
Sentence: "Ram has given the 10 books to sita."
1. Lowercase conversion.
2. Remove non-alphabetic characters (dots, commas). "10" would be removed if numerical.
3. Remove stop words (e.g., "the", "is", "to").
4. Apply lemmatization.
5. Count words (Bag of Words).
6. Perform NER (e.g., "Ram" tagged as NNP - proper noun).
Library Implementation Example
To use NLTK:
1. pip install nltk
2. Download WordNet data.
3. Import modules: from nltk.stem import PorterStemmer, WordNetLemmatizer.
Questions asked in class
- Q (Anuja): What happens if a new word (not in the lemma dictionary) appears?
- A: Lemmatization will not work for that new word. It can be added to the library by developers in new versions of the database.
- Q: Does stemming work in other languages?
- A: Yes, 100%. Every language has its own dictionary within NLP libraries (e.g., Hindi, German, Bengali). The dataset is available; we need to import the relevant data.
- Q: In practice, how significantly does correct part-of-speech tagging impact lemmatization?
- A: It impacts 100%. If we incorrectly tag a word (e.g., tag a verb as a noun), the output will be wrong.
- Q (Shriya): Can you give an overview of the pipeline for an NLP task?
- A: Input sentence → tokenization → normalization (stemming/lemmatization) → model application (CNN, RNN, transformer). Pre-processing is done before feeding data to the model.
- Q: Should tokenization be done before or after stemming?
- A: Tokenization is done first, then stemming or lemmatization.
- Q: Is word embedding similar to stemming/lemmatization?
- A: Word embedding converts text to numerical data; it happens after stemming/lemmatization.
- Q: Does POS matter for lemmatization if we only provide tokens, not full sentences?
- A: Yes, POS information is needed for accurate lemmatization. It can be provided as a parameter.
- Q: If a word repeats twice in a sentence, will tokenization count it twice?
- A: Yes, token count includes repetitions (e.g., "india" appears twice will be counted twice).
- Q: In real-world AI projects, do companies still use stemming or lemmatization?
- A: Yes, it depends on the use case and condition.
- Q: Is it necessary to specify POS during lemmatization?
- A: It is not strictly necessary but is desirable for accuracy.
- Q: In the previous example, how was "how" also removed? "which", "then", "what", "why" will also be counted?
- A: Yes, 100%. All these can be stop words. In English, they are stop words and can be removed.
- Q: Could you explain about different types of embedding models like GloVe or word embedding?
- A: That is part of theory; will tell in next class.
Key takeaways
- Text normalization (stemming/lemmatization) reduces vocabulary size and improves data consistency for NLP models.
- Tokenization is always the first step in text preprocessing.
- Stemming is a fast, rule-based heuristic that chops off word endings but may produce invalid words.
- Lemmatization is a slower, vocabulary-based method that returns the dictionary base form (lemma) of a word.
- Lemmatization requires Part-of-Speech (POS) information for high accuracy; incorrect POS tags lead to incorrect lemmas.
- Stop words are common words (e.g., "the", "is") often removed to reduce noise and focus on meaningful content.
- Named Entity Recognition (NER) identifies and classifies entities like person names and locations.
- The standard NLP pipeline flows: Raw Text → Tokenization → Normalization → Stop Word Removal → POS/NER → Embedding → Model.
- The Porter and Lancaster stemmers are both rule-based; Lancaster is described as an "advanced version."
- Word embedding is a subsequent step that converts processed tokens into numerical vectors.
- Libraries like NLTK provide built-in functions for stemming (PorterStemmer) and lemmatization (WordNetLemmatizer).
- The choice between stemming and lemmatization depends on the task requirements: speed vs. linguistic accuracy.
Exam-style questions
1. Compare and contrast stemming and lemmatization. When would you choose one over the other?
- Answer Outline: Define both. Contrast: Stemming uses heuristics/rules (fast, may create non-words); Lemmatization uses vocabulary/morphology (slow, accurate, needs POS). Choose stemming for speed-critical tasks where exact word form isn't crucial; choose lemmatization for tasks requiring linguistic precision (e.g., question answering).
2. Describe the step-by-step preprocessing pipeline for the sentence: "The 3 cats are running quickly." Assume you are applying lowercase conversion, alphabetic filtering, stop word removal, and lemmatization (with verb POS for 'running').
- Answer Outline: 1. Lowercase: "the 3 cats are running quickly". 2. Remove non-alphabetic: "cats are running quickly" (removes "3"). 3. Remove stop words: "cats running quickly" (removes "are", "the"). 4. Lemmatize "running" (POS='verb'): "run". Final tokens: ["cats", "run", "quickly"].
3. Explain why Part-of-Speech (POS) information is critical for lemmatization. Provide an example where the lemma changes based on POS.
- Answer Outline: Lemmatization uses morphological analysis to find the dictionary form, which depends on grammatical role. Example: Word "saw". As a verb (POS='VERB'), lemma is "see". As a noun (POS='NOUN'), lemma is "saw" (the tool). Without correct POS, the wrong lemma is returned.
Glossary
- NLP (Natural Language Processing) - A field of AI dealing with computer understanding and manipulation of human language.
- Text Normalization - Transforming text into a standard, consistent format.
- Tokenization - Splitting text into individual words or sentences (tokens).
- Stemming - A heuristic process of removing prefixes/suffixes to find a word's stem.
- Lemmatization - The process of determining the dictionary base form (lemma) of a word using vocabulary and morphology.
- Lemma - The canonical, dictionary base form of a word.
- Stop Words - Common words (e.g., "the", "a", "is") often filtered out during text preprocessing.
- Named Entity Recognition (NER) - Identifying and classifying named entities (e.g., persons, organizations) in text.
- Bag-of-Words (B-O-W) - A text representation model that counts word frequencies.
- Corpus - A large and structured collection of text data.
- Part of Speech (POS) - The grammatical category of a word (e.g., noun, verb, adjective).
Follow-ups
- A coding session will follow to demonstrate the implementation of Porter Stemmer, WordNetLemmatizer, and the preprocessing pipeline.
- Detailed explanation of word embedding techniques (e.g., GloVe) is promised for the next class.
- The course will proceed to cover models: CNN (next class), followed by RNN, LSTM, and Transformer, including why the Transformer is required.
- Instructor will upload slides and code (IPython notebook) before future classes.
- Image preprocessing was mentioned as less complex than text preprocessing for CNN applications.