0Pricing
Deep Learning Academy · Aula

Separe Treinamento, Validação e Teste

Entenda por que você precisa de três conjuntos, não de um

Separe Treinamento, Validação e Teste é uma aula grátis de Deep Learning Academy no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Deep Learning Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Deep Learning Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

One Pile Is Not Enough

If you train and judge a model on the same data, you only learn that it memorized those rows. To trust it, you must split your data into separate roles.

Meet the Training Set

The training set is the data your model actually learns from. Its weights are nudged again and again to fit exactly these examples well.

Meet the Validation Set

The validation set is held back during training and checked along the way. It tells you how the model does on data it has never updated on.

Meet the Test Set

The test set is touched once, at the very end. It gives an honest, final score after every choice has already been made.

Why Validation Is Separate

You tune knobs like learning rate by watching validation results. That quietly leaks the validation set into your choices, so it can no longer be a clean final judge.

The Test Set Stays Sealed

Because validation guided your decisions, you need one untouched pile for the truth. Keep the test set sealed until you are completely done.

A Common Split

A typical starting point is roughly 80/10/10: most data for training, smaller slices for validation and test. Adjust based on how much data you have.

Split with random_split

PyTorch gives you random_split to carve a dataset into pieces by length. It shuffles which samples land in each set for you.

from torch.utils.data import random_split
train, val, test = random_split(ds, [800, 100, 100])

Seed for Reproducible Splits

The split is random, so set a seed if you want the same pieces every run. That keeps experiments comparable across sessions.

g = torch.Generator().manual_seed(42)
train, val, test = random_split(ds, [800, 100, 100], generator=g)

Stratify for Balance

With rare classes, a plain random split may leave some out. Stratifying keeps each set's class mix close to the original so scores stay meaningful.

Never Peek at Test

The golden rule is simple: do not let the test set shape any decision. The moment it does, your final number stops being trustworthy.

Quick Check

Which set should you look at only once, at the very end?

Recap

Three sets, three jobs: training teaches the model, validation guides your tuning, and test gives the final honest score. Keep test sealed until the end. 🎯

Perguntas Frequentes

A aula “Separe Treinamento, Validação e Teste” é grátis?

Sim — o texto completo de “Separe Treinamento, Validação e Teste” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Deep Learning Academy, atualize para CoddyKit PRO. O curso de Deep Learning Academy inclui 4 aulas no total.

O que vou aprender em “Separe Treinamento, Validação e Teste”?

Entenda por que você precisa de três conjuntos, não de um Você pratica Deep Learning Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Deep Learning Academy?

Nenhuma experiência prévia é necessária. Deep Learning Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.

Quanto tempo leva a aula “Separe Treinamento, Validação e Teste”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Deep Learning Academy?

Sim. Cada aula de Deep Learning Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Separe Treinamento, Validação e Teste
  2. Um Ciclo de Épocas com Validação
  3. Salve e Carregue com state_dict
  4. Parada Antecipada com a Perda de Validação
← Voltar para Deep Learning Academy