Supervised Learning

</>Coding Tamilan.← AI course & curriculum

AI · LESSON 06 / 25 · English

Supervised Learning

Learn from examples that include the answer.

Beginner-friendly explanationsAI method + worked scenarioPractice + answer

Content reviewed: 22 October 2026 · தமிழில் படிக்க ↗

01 / THE IDEA

Understand it in plain language

Supervised learning uses labelled examples. Classification predicts a category; regression predicts a numerical value. The labels must mean what the product needs, and the evaluation split must reflect future use. Repeated records from the same person or object can leak across a careless split.

How the AI approach works

Supervised learning learns from input–target pairs. A target must match the decision we need at inference time. “Customer complained” is not necessarily the same label as “product is defective.” If labels reflect an old process or inconsistent human judgments, optimizing the model against them can reproduce those mistakes accurately.

Classification estimates a category or category scores; regression estimates a numeric quantity. Logistic regression, decision trees, random forests, gradient boosting, nearest neighbors, and neural networks are different possible model families. A model that returns a score does not necessarily return a well-calibrated probability. Classification thresholds should reflect the relative costs of missed positives and false alarms.

Build a repeatable pipeline: define labels, audit examples, split appropriately, fit preprocessing and the model on training data, tune on validation, and report a final held-out result. Stratification can preserve label proportions; group-based and time-based splits address different dependencies. The split must resemble how the model will encounter genuinely new cases.

Inspect errors rather than reporting one aggregate number. For a support classifier, compare English, Tamil, code-mixed messages, and rare categories. Include an uncertainty or review path when the input is ambiguous or outside the supported categories. A model should not be forced to invent a supported label for every possible request.

02 / STEP BY STEP

Break the idea into steps

  1. Define labels consistently and check a sample manually.
  2. Separate training, validation, and final test roles.
  3. Inspect errors by useful groups and choose metrics that fit the task.

Worked example: connect the method to the task

Suppose a classifier routes course messages to “access,” “payment,” or “lesson question.” Label a representative sample using written guidelines. Keep all messages from one conversation in one split. Compare a majority-class baseline with a simple text classifier, then review the confusion matrix.

If Tamil payment messages are repeatedly routed to access support, inspect tokenization, training coverage, label consistency, and examples before choosing a larger model. The error pattern tells you what to investigate; model size alone does not explain it.

Algorithm experiment: predict, change, explain

This one-nearest-neighbor classifier predicts a size label from one measured feature. The four hand-written examples explain nearest-neighbor inference; they do not validate fruit recognition. Change query = 170 to 90 and predict the label first.

main.py · focused experimentPYTHON
samples = [(80, "small"), (100, "small"), (180, "large"), (200, "large")]
query = 170
nearest = min(samples, key=lambda row: abs(row[0] - query))
print("prediction:", nearest[1])
Predict first, then reveal the checked output
prediction: large
04 / TRY IT

Change one thing. Run it again.

Run this small, self-contained experiment in standard Python. No package installation or paid API is required. Change the suggested variable and explain the effect on the method before applying it to real data.

Open Python editor ↗

Let the editor finish loading, load this example, then press Run.

The free editor uses OneCompiler, an external service. Code you run is sent there. Do not enter passwords, API keys, or private student data. If an example is sent before the editor is ready, wait and load it again.

Apply the idea: check your reasoning

Think before revealing the answer

A dataset has 95 access messages and 5 payment messages. Is 95% accuracy sufficient evidence of success?

Reveal the answer and reasoning

No. Predicting access for everything already scores 95% while missing every payment case. Examine per-class precision and recall and compare with that baseline.

A common mistake: A label can be noisy or biased; it is not automatically ground truth just because it is in a file.

Before you move on

  • Explain the main idea without repeating the technical label.
  • Identify the approach, its assumptions, and the evidence needed to trust the result.
  • Complete the challenge, then compare your reasoning with the answer.

Sources & a deeper next step

The refresh uses primary papers and official documentation. These optional links are in English; you can understand this lesson without reading them first. Product versions and availability can change.

Coding Tamilan · Understand the idea. Test the claim. Build responsibly.