Basics

What is machine learning — and why nobody wrote the rule for “this is a cat”

Illustration: a model looks at a pile of examples and derives the rule itself

Here's the surprising part. A normal program is written as rules: "if the email contains the word 'winner' → spam." Now try this: write a rule that tells a cat from a dog in a photo. You'll get stuck on line one. Ears? Dogs have pointy ones too. Whiskers? Not always visible.

So here's the thing: the rule for "this is a cat" was never written. The machine figured it out itself, after looking at thousands of photos. And the weirdest part — even the person who trained it can't point to where "cat" is stored inside. In a couple of minutes you'll see how that happened.

What it is — code that learns from examples

Machine learning (ML) is a way to solve problems with examples instead of rules.

Compare the two approaches:

  • Normal program: a human writes rules → the program applies them to data → out comes an answer.
  • Machine learning: a human gives data and answers → the program finds the rules itself → those rules apply to new data.

We flip the arrow. Rules used to be the input. Now they're the output. You show the system 10,000 emails labeled "spam / not spam," and it works out for itself which features give spam away. Nobody sits down and writes the word list by hand.

That's the "learning" in the name: not memorizing, but finding a pattern in examples.

How it works — examples instead of rules

Let's take a toy case. We want to predict an apartment's price.

  1. Collect examples. Thousands of apartments: floor area, floor number, district — and the real price they sold for. Those are your "correct answers."
  2. The model guesses. At first it stabs in the dark: names a price at random and misses.
  3. Measure the error. By how much did it miss? A million? Fine, note it.
  4. Nudge. The model tweaks its internal settings a little so next time it misses less. Then repeats steps 2–4 a few million times.

Gradually the error drops. At some point the model predicts prices for apartments it has never seen. It didn't memorize the answers — it found a pattern: "bigger area → pricier, farther from center → cheaper," plus dozens of subtler links a human couldn't put into words.

This is exactly how a neural network works: those "internal settings" are its weights, and nudging them on examples is the training. When there are billions of those settings and the whole internet for examples, you get a large language model like ChatGPT.

Why it matters to you

Sounds like theory. But this one idea explains three things beginners trip over.

First: why AI is sometimes confidently wrong. The model doesn't "know" the right answer — it found a pattern in examples. If the examples were skewed, the answers will be too. Garbage in → garbage out.

Second: why "give it more data" actually works. More good examples → a sharper pattern. It's not magic or marketing: ML quality grows directly with the quality and quantity of the data the model learned from.

Third: how ML differs from the normal code you write with AI. When you vibe-code a website, that's ordinary rules — an assistant just writes them for you. But the assistant itself, inside, is ML. It helps to feel the line: where it's deterministic code, and where it's a "trained guesser."

Where you've already met it

Spoiler: everywhere.

  • The recommendation feed in a social app — ML predicting what will hold your attention.
  • Autocomplete on your keyboard — predicting the next word.
  • Face unlock, the spam filter, translation, voice input.
  • Every ChatGPT reply is ML at the moment of inference — predicting the next chunk of text.

None of these were "programmed" with rules head-on. All of them learned from examples.

Is machine learning the same as artificial intelligence?

No — ML is a part of AI, the most practical part today. "Artificial intelligence" is a broad umbrella (old rule-based systems counted too). Machine learning is one specific approach under it: learning from data. Almost everything called "AI" right now is ML.

Do I need math to use it?

To build models from scratch — yes, it helps. To use ready-made ones (call a model via API, build an app with AI) — no. You work with a trained model like a black box: give an input, get an answer. Understanding the idea helps; deriving the formulas isn't required.

Is machine learning the same as deep learning?

Deep learning is a subset of machine learning where the patterns are found by a neural network with many layers. All deep learning is ML, but not all ML is deep — plenty of models are simpler, with no neural network. It's the deep networks specifically that drove the leap of recent years — image recognition and language models run on them.

Learn vibe coding — don’t just read about it

Short story-lessons, an agent simulator and daily practice — in our mobile app. Free.

Open the app
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →