AI Sikho — Train Your Own AI Classifier

Tagline: Learn how AI really works by training a tiny classifier yourself — live in your browser, no server, no sign-up.

Try it out: Live app — https://devilking7x.github.io/ai-sikho/ · Source code — https://github.com/devilking7x/ai-sikho

Inspiration

Most "learn AI" tools either show you a black-box demo or ask you to trust a big model you can't see inside. A beginner never learns how the machine actually learns — what it counts, what it weighs, and where it goes wrong. AI Sikho (AI सीखो, "Learn AI") is the opposite: a playground where you train a real classifier yourself and watch every number move.

What it does

  • Two Hindi/Hinglish/English datasets — sort messages into Scam vs Normal, or sentences into Khush (happy) vs Gussa (angry).
  • Live scoreboard — every change retrains the model instantly. You see training size, vocabulary size, and accuracy on a held-out test set (examples the model never trained on), plus a confusion table showing exactly which mistakes it made.
  • Add your own examples — type any sentence, label it, and watch accuracy move. A good example helps; a bad one hurts. That's learning, visible. A "Load sample progress" button adds 3 clearly-labelled sample examples (training count 16 → 19) so the learning loop is visible in one click, and Reset restores the starting point.
  • Look inside the model — a word-weight table shows each word's log-odds weight, so you see why "lottery" screams scam and "homework" doesn't.
  • Try any sentence — get a prediction with per-label probabilities and the top words that drove the decision, each with its individual contribution.

The AI, honestly: multinomial Naive Bayes with Laplace smoothing, implemented from scratch in ~150 lines of plain JavaScript (classifier.js). No API calls, no pre-trained black box, no fake results — every number on the page is computed from the examples you see. Seed accuracy is deliberately imperfect (scam set 7/8 = 88%, mood set 6/8 = 75%), because a tiny model trained on 16 examples genuinely is limited — and the app says so on the page, in a dedicated "Honest limits" section (bag-of-words, no word order, no sarcasm, not a real scam detector).

Who it helps: students and first-time AI learners — especially Hindi-first learners, who rarely get ML explainers in their own language mix. It runs fully offline once loaded, needs no account and no API key, and stores nothing: your examples never leave your browser.

How we built it

Plain HTML, CSS and JavaScript (ES modules). The classifier (classifier.js, ~150 lines) is a dependency-free module: tokenisation, per-class word counts with Laplace smoothing, softmax probabilities, and word log-odds weights. The UI (app.js) calls the same train/predict/evaluate functions the tests call, so the scoreboard numbers are the model's real numbers. Tests: 12 unit tests (npm test) plus a Playwright smoke test (npm run smoke).

Challenges we ran into

Devanagari tokenisation broke first. My tokenizer treated word characters as \p{L} (letters only) — but in Devanagari, combining marks like virama and nukta are \p{M} (marks), not letters, so words were being split mid-syllable and the model was learning fragments. A unit test caught it: a Hindi example tokenised into pieces that didn't match anything. The fix was to include \p{M} in the token pattern, and the test now pins Devanagari tokenisation explicitly. The second bug was quieter: some UI elements the smoke test expected had no IDs, so the test couldn't find them — the app worked, but it wasn't testable. Adding the missing IDs made the page verifiable, which is the whole point of this app.

Accomplishments that we're proud of

  • A real classifier a beginner can train, break, and fix — with the accuracy moving live as they add examples.
  • A word-weight table that makes Bayes' rule visible: you can literally see "lottery" pushing toward scam.
  • Honest seed accuracy (88% / 75%) shown on the page instead of a flattering number — the imperfection is the lesson.
  • Devanagari tokenisation done correctly (virama/nukta as combining marks), tested and pinned.
  • 12/12 unit tests passing, plus a Playwright smoke test.

What we learned

  • How Bayes' rule turns word counts into probabilities, why Laplace smoothing exists (so an unseen word never means zero probability), and why a held-out test set is the only honest accuracy.
  • That tokenisation is where multilingual ML actually breaks — the maths was easy, the Devanagari combining marks were the real bug.
  • That a learner understands "training" the moment they see one bad example hurt accuracy: the feedback loop is the teacher.

What's next for AI Sikho

  • A third dataset (e.g. positive vs negative movie reviews in Hinglish) so learners see the same method on a different problem.
  • A "confusion explorer" that lets you click a wrong test prediction and see exactly which words misled the model.
  • A short guided lesson path (5 steps with checkmarks) that walks a first-time learner from "what is training data" to "I trained a model" — the sample-progress button is the first piece of that path.

Built With

HTML, CSS, JavaScript (ES modules), Node.js 20, Playwright

Testing instructions (for judges)

  1. Open the live link — no install, no sign-up. The scoreboard shows 16 training examples, 8 held-out test examples, and accuracy (scam set: 7/8 = 88%).
  2. Click "Load sample progress" — 3 labelled sample examples are added (training count 16 → 19) and the scoreboard retrains live. Click Reset to restore the starting point.
  3. Scroll to Step 5 — Khud try karo, type Congratulations, you won 10 lakh rupees lottery, pay fee to claim and click Predict karo — it predicts SCAM with probabilities and the words that decided it.
  4. In Step 3, add your own example (e.g. Kal subah school ki chhutti hai as normal) and watch the training count go up and the model retrain instantly.
  5. Switch to the Khush ya Gussa? tab and try I am so happy, I passed my exam — it predicts KHUSH.
  6. Run the tests yourself: git clone https://github.com/devilking7x/ai-sikho, npm install, npm test (12 unit tests) and npm run smoke (Playwright browser test).

Built With

Share this project:

Updates

Submission history