0Pricing
Deep Learning Academy · レッスン

入力を正規化・標準化する

学習が収束するよう特徴量をスケーリングします

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

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

Raw Numbers Slow Learning

Features on wildly different scales, like age and salary, confuse a network. Rescaling them first is why normalization makes training converge faster. ⚖️

Two Common Recipes

You will meet two main scalers: standardization shifts data to mean zero and unit variance, while min-max squeezes it into a fixed range like 0 to 1.

Standardize with Mean and Std

Standardization subtracts the mean and divides by the standard deviation. The result is centered on zero with a spread of one, the deep learning default.

x = (x - x.mean()) / x.std()

Min-Max Scaling

Min-max scaling maps your smallest value to 0 and largest to 1. It is handy when a bounded input range matters, like pixel intensities.

x = (x - x.min()) / (x.max() - x.min())

Fit on Train Only

Compute the mean and std from the training set only. Reusing test data to set these stats leaks information and inflates your scores.

Reuse the Same Stats

Apply the exact training statistics to validation and test data. Both splits must be transformed the same way or your model sees mismatched inputs.

x_val = (x_val - train_mean) / train_std

Per-Channel for Images

For images you normalize each color channel with its own mean and std. PyTorch ships transforms.Normalize to do exactly this in a pipeline.

transforms.Normalize(mean=[0.5], std=[0.5])

Borrow Known ImageNet Stats

When using pretrained vision models, normalize with the ImageNet means and stds they were trained on. Matching those numbers keeps inputs in the expected range.

Do It Inside __getitem__

The cleanest spot to scale is your dataset's __getitem__ or a transform. Then every sample arrives normalized without extra code in your training loop.

Watch for Divide by Zero

If a feature is constant its std is zero and dividing explodes. Add a tiny epsilon to the denominator to keep the math safe and stable.

x = (x - mean) / (std + 1e-8)

Small Step, Big Payoff

Normalizing inputs is a quick preprocessing habit, yet it often unlocks faster, more stable training. Skip it and even a good model may crawl.

Quick Check

From which split should you compute normalization statistics?

Recap

Normalization rescales features so training converges, using stats fit on the training set and reused everywhere, often inside a transform. 🎉

よくある質問

「入力を正規化・標準化する」レッスンは無料ですか?

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

「入力を正規化・標準化する」で何を学びますか?

学習が収束するよう特徴量をスケーリングします ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

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

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

「入力を正規化・標準化する」レッスンにはどのくらい時間がかかりますか?

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

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

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

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

  1. カスタムDatasetクラスを書く
  2. バッチ化、シャッフル、num_workers
  3. 可変長入力のためのcollate_fn
  4. 入力を正規化・標準化する
← Deep Learning Academyに戻る