0Pricing
Data Science Academy · Lezione

Perché tenere da parte un test set

Stimare le prestazioni su dati mai visti.

Perché tenere da parte un test set è una lezione Data Science Academy gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Data Science Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Data Science Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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. 🎯

Domande Frequenti

La lezione «Perché tenere da parte un test set» è gratuita?

Sì — il testo completo di «Perché tenere da parte un test set» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Data Science Academy, passa a CoddyKit PRO. Il corso Data Science Academy include 4 lezioni in totale.

Cosa imparerò in «Perché tenere da parte un test set»?

Stimare le prestazioni su dati mai visti. Eserciti Data Science Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Data Science Academy?

Non è richiesta alcuna esperienza precedente. Data Science Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.

Quanto tempo richiede la lezione «Perché tenere da parte un test set»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Data Science Academy?

Sì. Ogni lezione Data Science Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Perché tenere da parte un test set
  2. Usare train_test_split correttamente
  3. Cross-validation K-Fold
  4. Prevenire il data leakage fin dall'inizio
← Torna a Data Science Academy