0Pricing
Deep Learning Academy · レッスン

確率のためのSoftmax

生のスコアをクラス分布に変換します

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

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

From Scores to Choices

A classifier's last layer spits out raw scores, one per class. These unbounded numbers are called logits, and they are hard to read directly. 🔢

Enter Softmax

Softmax turns a vector of logits into a clean probability distribution over all your classes. Now each score becomes a chance.

import torch.nn.functional as F
probs = F.softmax(logits, dim=-1)

Two Guarantees

Softmax promises two things: every output is between 0 and 1, and all of them sum to one. That is exactly what a distribution needs.

How It Works

Softmax exponentiates each logit, then divides by the total. The exponential makes bigger logits dominate, sharpening the winner.

exp = logits.exp()
probs = exp / exp.sum()

Relative, Not Absolute

Softmax cares about the gaps between logits, not their raw size. Adding the same constant to every logit leaves the probabilities unchanged.

Sigmoid vs Softmax

Use sigmoid for one yes-or-no output. Use softmax when classes compete and exactly one of several should win.

Picking the Winner

To get the predicted class, take the argmax of the softmax output. That index is the class with the highest probability.

pred = probs.argmax(dim=-1)

Mind the Dimension

Always set the right dim so softmax normalizes across classes, not across the batch. A wrong axis quietly ruins your probabilities.

Skip It While Training

During training you usually do not apply softmax yourself. The cross-entropy loss expects raw logits and applies it internally.

loss = F.cross_entropy(logits, target)  # logits, not probs

Why That Is Safer

Combining softmax and the log inside one function is more numerically stable. Doing both steps by hand can overflow or lose precision.

Temperature Tweaks Sharpness

Dividing logits by a temperature before softmax controls confidence. Low values sharpen the peak; high values flatten it out.

Quick Check

Think about what cross-entropy loss expects as its input.

Recap

Softmax converts logits into probabilities that sum to one, perfect for multiclass output. But let cross-entropy handle it during training. 🏁

よくある質問

「確率のためのSoftmax」レッスンは無料ですか?

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

「確率のためのSoftmax」で何を学びますか?

生のスコアをクラス分布に変換します ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

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

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

「確率のためのSoftmax」レッスンにはどのくらい時間がかかりますか?

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

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

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

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

  1. 非線形性が本当の力を引き出す理由
  2. ReLUとLeaky ReLU、GELUの仲間たち
  3. SigmoidとTanh:値を範囲に押し込む
  4. 確率のためのSoftmax
← Deep Learning Academyに戻る