
Programming is: data + rules → answer. Pricing houses, recognizing faces, understanding Portuguese — manual rules cannot handle it. The Machine Learning approach reverses the equation: data + example answers → the model (the rules). This text follows the course How Machine Learning Works, End to End by KodeKloud: from spreadsheets to ChatGPT, the cycle is the same.
The neuron is covered in the 3Blue1Brown post; the DL map in the freeCodeCamp crash course. Here the thread is the entire pipeline.
Rules vs. examples
clássico: Dados + Regras → Respostas
ML: Dados + Respostas → Regras (o modelo)
CRUD and invoices fit in if. Real estate with 40 subjective variables does not. You feed the algorithm historical data; it finds the relationship and predicts what it has not seen yet.
Spreadsheet: features, labels, dirty data
área m² | quartos | bairro | preço (y)
120 | 3 | Centro | 650.000
85 | 2 | Jardins | 720.000
45 | 1 | Subúrbio | 280.000
- X (features): what goes in — area, bedrooms, neighborhood, age.
- y (label): what you want to predict — the price.
- Sample: each row.
Before training: nulls (mean/median or drop), outliers, text → numbers (one-hot for the neighborhood), scaling (m² must not overwhelm “number of bedrooms” just because the number is larger).
Training vs. inference
Training: the model looks at thousands of examples and adjusts weights/biases until the error falls. It consumes GPUs, time, clusters. Inference: frozen weights; new data goes in and the answer comes out in milliseconds.
The simplest case — one variable:
ŷ = w · x + b
w is how much the price rises per m²; b is the baseline (“zero-area” land). A deep network is that line stacked up, with nonlinearity in between — the GPU in the GPU vs TPU post does nothing else.
Loss and the valley
Error for one house: y − ŷ. MSE takes the average of the squares:
MSE = (1/N) · Σ (y − ŷ)²
Squaring makes everything positive ( +100 and −100 do not cancel out) and penalizes outliers: being off by R$ 50 thousand hurts four times as much as being off by 25 thousand.
Gradient descent: start with a random weight, calculate the slope of the error curve, take a step in the opposite direction. The step size is the learning rate α:
w_novo = w − α · ∂Loss/∂w
High α: the model jumps over the bowl and never lands. Low α: it crawls, and may still get stuck in a local hole.
Generalizing — without leaking the test set
A score of 10 in training means nothing. What matters is data that is new.
- Training ~80% — adjusts weights.
- Validation ~10% — chooses the algorithm and hyperparameters.
- Test ~10% — the final exam, untouched.
Underfit: a straight line on a sine wave. Gets both training and test wrong. Overfit: a deep tree that memorizes noise. 99% in training, 50% with the real customer.
Data leakage: test information enters training. Classic example: normalizing with the global mean before the split. In real estate: the “agent's commission” column, which exists only because the house already sold for that price. The lab looks beautiful; production breaks.
The map of problems
Machine Learning
├─ supervisionado (tem y)
│ ├─ regressão (preço, temperatura)
│ └─ classificação (spam, churn, benigno/maligno)
└─ não-supervisionado (sem y)
├─ clustering (K-Means, perfil de cliente)
└─ dimensionalidade (PCA)
From ŷ = wx+b to ChatGPT
The cycle does not change: forward → loss → backprop → descent. An LLM just stacks billions of parameters on top of text.
- Token + embedding: text becomes pieces, pieces become vectors. “Linux” and “Unix” end up close together.
- Pretraining: predicting the next token across trillions of words. It becomes the universe's autocomplete — not an assistant yet, just continuing text in the style of the web.
- SFT: thousands of question/answer pairs. It learns to follow instructions.
- RLHF / DPO: humans rank answers; a reward model + reinforcement nudges it toward being helpful, honest, and refusing harmful requests.
In 2026 the extras are attention (Transformer), multimodality (text+image+audio), and agents (tool calling, terminal scripts, ReAct loop). On your own Linux machine, the same cycle fits in Ollama.
References
- Course: KodeKloud — How Machine Learning Works, End to End
- What is a neural network?
- Deep Learning for beginners
- GPU vs TPU
Spreadsheet, loss, gradient, split. ChatGPT is that with more zeros in the equation. No magic — and with leakage, the lab lies.