← Apps ← My Digital Space
Interactive Machine Learning Education

Hyperparameter
Optimization

Stop guessing. Start searching. Learn how to systematically find the best settings for your machine learning models — through interactive playgrounds and live strategy comparisons.

live search space exploration
trials: 0 best:
← low learning rate search space: learning rate × hidden units high learning rate →
3
Search Strategies
80
Data Points
4
Hyperparameters
100%
Runs in Browser
01 / The Big Idea

Parameters vs.
Hyperparameters

Every machine learning model has two kinds of settings. One kind the model learns by itself. The other kind you have to choose. That choice is everything.

LEARNED AUTOMATICALLY

Parameters

The model figures these out from data during training. You don't set them — gradient descent does, by minimizing the loss function step by step.

x₁ W₁, b₁ ŷ
class NeuralNet:
  self.W = 0.0173 # learned from data
self.b = -0.4281 # learned from data
EXAMPLES
Weights Biases Hidden states Attention scores
YOU CHOOSE THESE

Hyperparameters

The knobs you turn before training starts. They control how the model learns — and the wrong settings can ruin everything.

lr=0.01
epochs=100
units=64
model.fit(X, y, lr=0.01, epochs=100)
# ↑ lr and epochs are hyperparameters
EXAMPLES
Learning rate Epochs Hidden units L2 regularization Batch size Number of layers Dropout rate
Why care?

Same model.
Wildly different results.

A well-tuned model can be 10× more accurate than a poorly-tuned one — using the exact same architecture and data. Hyperparameters aren't a detail; they're the lever.

LR = 1.0
52%
Too high — model diverges, loss explodes
LR = 0.0001
78%
Too low — underfits, doesn't converge in time
LR = 0.05
97%
Just right — converges smoothly
02 / Hands On

The Playground

Train a real neural network on the classic two-moons dataset. Tune the knobs. Watch the decision boundary bend in real time. Find what works.

Hyperparameters

Adjust and train to see effects

0.10
0.00010.0010.010.11.0
Step size per gradient update. Log scale — every step is 10×.
8
26101420
Neurons in the hidden layer. More = more capacity.
0.001
1e-61e-41e-31e-20.1
Penalty on large weights. Prevents overfitting.
100
20100200300
Full passes over the dataset.
QUICK PRESETS
CURRENT CONFIG
MLP(281, lr=0.1, l2=0.001)

Decision Boundary

How the model classifies the entire input space

Class A
Class B

Training Loss

cross-entropy

How the error changes over epochs

Live Metrics

Real-time training statistics

EPOCH 0 / 0
LOSS
TRAIN ACCURACY
STATUS
Ready to train.

Loss Landscape by Learning Rate

See how different learning rates affect training — your current setting is highlighted

lr=1.0 (diverges) lr=0.3 (oscillates) lr=0.1 (fast) lr=0.05 (sweet spot) lr=0.001 (slow) lr=0.0001 (too slow)
03 / The Search

Three Ways to Find the Best

You can't try every combination. So how do you search? Watch three classic strategies race on the same problem — same budget, same goal, very different philosophies.

BUDGET (evaluations per method)
20
SPEED (delay per step)
250ms
Goal: Find the combination of Learning Rate × Hidden Units that maximizes validation accuracy on two-moons. Each evaluation trains a fresh model from scratch (25 epochs). Click Run to start the race.
Method 01

Grid Search

BEST ACC

Try every combination on a fixed grid. Thorough, but slow — wastes effort on bad regions.

Evals: 0 Time:
# Exhaustive enumeration
for lr in [0.001, 0.01, ...]:
  for hu in [4, 8, ...]:
    evaluate(lr, hu)
Method 02

Random Search

BEST ACC

Sample randomly. Surprisingly strong — especially in high dimensions where grid wastes budget.

Evals: 0 Time:
# Random sampling
for i in range(budget):
  lr = loguniform(1e-4, 1.0)
  hu = randint(2, 16)
  evaluate(lr, hu)
Method 03

Bayesian Opt.

BEST ACC

Build a surrogate model of the objective. Use it to intelligently pick the next point. Sample-efficient.

Evals: 0 Time:
# Smart search with surrogate
gp = GaussianProcess()
for i in range(budget):
  x = maximize(UCB(gp))
  y = evaluate(x)
  gp.update(x, y)

Live Leaderboard

Press "Run Comparison" to start.
Grid Search
Random Search
Bayesian Opt.
04 / Takeaways

What to Remember

Five practical lessons to carry into your own machine learning projects.

Use log scale for learning rate

The difference between 0.001 and 0.01 matters as much as between 0.01 and 0.1. Sample logarithmically — or waste most of your budget on bad regions. This applies to regularization too.

Random beats grid in high dimensions

Grid search exhausts budget on irrelevant dimensions. Random search naturally concentrates budget on what matters — the famous "Bergstra & Bengio" result. The curse of dimensionality is real.

Bayesian shines when evals are expensive

Training a model for hours? Bayesian Optimization finds good solutions in fewer trials by learning from past evaluations. Cheap evals? Random is fine. The surrogate model pays off when each trial hurts.

Always use a validation set

Tuning on training data is cheating yourself. Use a separate validation set (or cross-validation) — otherwise you're optimizing for the wrong target and your model will fail in production.

Don't tune what doesn't matter

Before optimizing, identify which hyperparameters actually affect performance. For deep learning: learning rate, regularization, and model size usually dominate. Batch size and optimizer settings matter less. Spend your budget where it counts — and remember that the best architecture often beats the best-tuned bad one. When in doubt, run a small random search first to see what matters, then focus your budget there.

HIGH IMPACT
Learning rate, regularization, model size
MEDIUM
Batch size, optimizer choice, dropout
LOW IMPACT
Layer init scheme, momentum coefficients