Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
NLP with Python: Transformers, LLMs, Text Classification
New
1 students

NLP with Python: Transformers, LLMs, Text Classification

TF-IDF, embeddings and BERT through classification, topic models, NER, question answering, OCR and speech.
Created byReal Numbers
Last updated 10/2026
English
English

What you'll learn

  • Report any model score with its baseline, its split and its metric named - the habit this entire course is built to instil
  • Build a cleaning pipeline whose removals are counted and asserted, rather than a sequence of steps you hope worked
  • Derive TF-IDF properly, know which idf variant your library uses, and treat min_df as a modelling decision
  • Read a per-class table and tell a reluctant classifier from a confused one, then fix the one you actually have
  • Score a topic model against ground truth, and recognise when a bound is in the data rather than in your tuning
  • Evaluate entity recognition strictly, where partial span matches score zero and token accuracy flatters
  • Probe a PDF for a text layer before reaching for OCR, and normalise both sides before trusting a word error rate
  • Choose between a classical pipeline and a general model on volume, latency, cost and auditability

Course content

11 sections • 51 lectures • 7h 37m total length
  • Welcome, and how to use this course4:35

    How the course is structured, how the offline labs and their exit codes work, why the corpus is synthetic and seeded, and why several methods are going to lose.

Requirements

  • Comfortable writing Python - loops, functions, and pandas DataFrames
  • No NLP background needed; the course starts from why text is not numbers
  • Basic familiarity with a classifier and what a train/test split is for
  • A machine that runs Python 3.10 or later. The labs are offline and need no GPU

Description

This course contains the use of artificial intelligence.
Most NLP courses show you a method, print a number, and move on. You are never told what that number would have been if the model had learned nothing at all.

This course publishes that floor next to every result, and the data is synthetic and seeded so you can reproduce each figure on your own machine to the digit.

Here is what that buys. A classifier on this corpus scores 69.83 per cent accuracy across seven categories. On its own that sounds respectable. The majority-class floor is 25.60 per cent, so the model earned about forty-four points, not sixty-nine. Break it out per class and precision holds steady while recall collapses from 0.7474 to 0.5368 - the model is not confused about rare categories, it is reluctant to commit to them. None of that is visible in the headline, and the headline is what most courses report.

Text preparation as a measurable job. The shipped corpus arrives dirty: HTML, doubled encoding, signature blocks, quoted replies, duplicate clusters and empty bodies. A correct deduplication removes 398 rows, not 412, because the first of each cluster is a real ticket - and getting that off by the cluster count is the commonest error in a cleaning pipeline.

Representation, derived rather than imported. Bag of words and TF-IDF including the exact formula scikit-learn uses, and why a third of this vocabulary is noise that inverse document frequency rewards hardest. Word embeddings as the by-product of a prediction task. Contextual embeddings and the single change that matters - one vector per occurrence rather than one per word type.

Then the methods, each scored. Classification with imbalance taken apart rather than mentioned. Topic modelling measured against known truth, where two planted topics share eighteen of their twenty-two words and no algorithm, seed or component count will separate them. Named entity recognition evaluated strictly, where a span is wrong unless both boundaries and the type are right. Extractive question answering over real PDFs.

Two of this course's own premises died under measurement. Running OCR on a PDF that already has a text layer is slower, dearer and worse - so the pipeline probes first and falls back second. And on speech: most of the word error rate on a correct transcript is not recognition error at all, it is surface form, because the engine wrote the digits the reference spelled out. What actually breaks is proper nouns and domain vocabulary.

Classical NLP in the era of general models - the question this course has to answer. Argued from mechanism and economics rather than from accuracy claims, ending in a decision table you could defend to a sceptical colleague.

Nineteen hands-on labs. Each runs top to bottom with no edits and no network, exits 0 when every assertion passed, 1 on a failure and 2 when a dependency is missing - and asserts against the same published figures the lectures quote, so the lab and the lecture cannot drift apart.

What this course will not do. It will not quote a transformer or language-model accuracy figure, because those depend on weights that move and a number that drifts is worse than no number. It will not quote a token price, because any price written down here would be wrong within a year while the formula stays correct. And it will not report a score without the baseline beside it.

Who this course is for:

  • Data scientists and engineers who can fit a text model but are unsure whether their evaluation is honest
  • Anyone who has reported an accuracy figure and been unable to answer 'compared with what?'
  • Practitioners asked whether a general model has made their NLP pipeline obsolete, who want the argument rather than the slogan
  • Engineers inheriting a text pipeline who need to find out what it actually does before changing it