Softmax für Wahrscheinlichkeiten
Wandeln Sie Rohwerte in eine Klassenverteilung um.
Softmax für Wahrscheinlichkeiten ist eine kostenlose Deep Learning Academy-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Deep Learning Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
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 probsWhy 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. 🏁
Häufig gestellte Fragen
Ist die Lektion „Softmax für Wahrscheinlichkeiten“ kostenlos?
Ja — der vollständige Text von „Softmax für Wahrscheinlichkeiten“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Deep Learning Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Softmax für Wahrscheinlichkeiten“?
Wandeln Sie Rohwerte in eine Klassenverteilung um. Du übst Deep Learning Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Deep Learning Academy zu starten?
Keine Vorkenntnisse erforderlich. Deep Learning Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Softmax für Wahrscheinlichkeiten“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Deep Learning Academy-Lektion Code schreiben und ausführen?
Ja. Jede Deep Learning Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Warum Nichtlinearität echte Leistungsfähigkeit freisetzt
- ReLU und ihre Varianten Leaky ReLU und GELU
- Sigmoid und Tanh: Auf einen Wertebereich begrenzen
- Softmax für Wahrscheinlichkeiten