0Pricing
Deep Learning Academy · レッスン

学習用・検証用・テスト用に分割する

データセットが1つではなく3つ必要な理由を学びます

「学習用・検証用・テスト用に分割する」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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

よくある質問

「学習用・検証用・テスト用に分割する」レッスンは無料ですか?

はい。「学習用・検証用・テスト用に分割する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。

「学習用・検証用・テスト用に分割する」で何を学びますか?

データセットが1つではなく3つ必要な理由を学びます ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Deep Learning Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「学習用・検証用・テスト用に分割する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDeep Learning Academyレッスンでコードを書いて実行できますか?

はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 学習用・検証用・テスト用に分割する
  2. 検証を含むエポックループ
  3. state_dictで保存と読み込みを行う
  4. 検証損失による早期停止
← Deep Learning Academyに戻る