0Pricing
Data Science Academy · Aula

Por que separar um conjunto de teste

Estimando o desempenho em dados não vistos.

Por que separar um conjunto de teste é uma aula grátis de Data Science 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 Data Science Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Data Science Academy inclui 4 aulas no total.

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

The Real Question

A model that memorizes your data looks brilliant on it. The real question is how it does on data it has never seen.

Hold Some Data Back

So you set aside part of your data and never train on it. This locked-away slice is your test set, kept for the very end.

Train Here, Judge There

The model learns only from the training set. You then judge it on the untouched test set to see how it truly generalizes. 🎯

Why Not Score on Training

Scoring on the same rows it learned from is like grading a test with the answer key open. That number flatters the model and overstates its skill.

Generalization Is the Goal

You do not care how well it fits old data. You care about generalization: making good predictions on tomorrow's fresh, unseen rows.

Meet Overfitting

When a model nails training data but flops on the test set, it is overfitting. It memorized noise instead of learning the real pattern.

A Common Split

A simple, popular choice is to train on about 80% of rows and test on the remaining 20%. More data to learn, enough left to judge fairly.

Touch It Only Once

The test set is sacred. If you keep peeking and tweaking until the score looks good, you have quietly leaked it into your decisions.

Where the Split Happens

In scikit-learn, one helper does the splitting for you. It shuffles and carves your data into train and test parts in a single call.

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

The Honest Number

The score on the test set is your honest estimate of real-world performance. Trust it more than any glowing training score.

More Than a Formality

Holding out data is not red tape. It is the one habit that stops you from shipping a model that only ever worked on paper.

Quick Check

Why do you keep a separate test set?

Recap

You split data, learn on the train part, and judge on a sacred test set. That untouched slice is your honest read on real-world skill. 🎯

Perguntas Frequentes

A aula “Por que separar um conjunto de teste” é grátis?

Sim — o texto completo de “Por que separar um conjunto de 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 Data Science Academy, atualize para CoddyKit PRO. O curso de Data Science Academy inclui 4 aulas no total.

O que vou aprender em “Por que separar um conjunto de teste”?

Estimando o desempenho em dados não vistos. Você pratica Data Science 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 Data Science Academy?

Nenhuma experiência prévia é necessária. Data Science 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 “Por que separar um conjunto de 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 Data Science Academy?

Sim. Cada aula de Data Science 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. Por que separar um conjunto de teste
  2. Usar train_test_split corretamente
  3. Validação cruzada em K partes
  4. Impedir o vazamento de dados antes que comece
← Voltar para Data Science Academy