ROC, AUC und Schwellenwerte
Die Rankingqualität über verschiedene Grenzwerte beurteilen
ROC, AUC und Schwellenwerte ist eine kostenlose Data Science 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 Data Science Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Data Science Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Models Output Probabilities
Most classifiers do not just say yes or no. They give a probability, like 0.73, and you decide where to draw the line. 🎚️
probs = model.predict_proba(X)[:, 1]The Decision Threshold
A threshold turns a probability into a label. Above it means positive, below means negative. The default 0.5 is just one choice.
y_pred = probs >= 0.5Moving the Line
Lower the threshold and you catch more positives but raise false alarms. Raise it and you are stricter but miss more. Each setting trades off.
Two Rates to Track
As the threshold slides, watch the true positive rate against the false positive rate. Together they describe the model at every cutoff.
The ROC Curve
The ROC curve plots true positive rate versus false positive rate across all thresholds, showing the full trade-off in one picture.
from sklearn.metrics import roc_curve
fpr, tpr, thr = roc_curve(y_true, probs)Reading the Shape
A curve that hugs the top-left corner is excellent: high catch rate with few false alarms. A diagonal line means random guessing.
Area Under the Curve
AUC squeezes the whole ROC curve into one number: the area beneath it. It summarizes performance across every threshold at once.
from sklearn.metrics import roc_auc_score
roc_auc_score(y_true, probs)What AUC Means
AUC of 1.0 is perfect, 0.5 is coin-flip random. Read it as the chance the model ranks a true positive above a true negative.
Threshold-Free Comparison
Because AUC ignores any single cutoff, it is great for comparing models. The winner ranks positives ahead of negatives more often.
Then Pick a Threshold
AUC picks the model, but you still set the threshold for real use, tuning it to favor recall or precision as the problem demands.
When to Prefer PR Curves
On very imbalanced data, ROC can look rosy. A precision-recall curve often tells the harder truth about rare-class performance.
Quick Check
Let's confirm what AUC really tells you about a classifier.
Recap
The threshold turns probabilities into labels, the ROC curve shows every trade-off, and AUC scores the whole curve at once. 🎯
Häufig gestellte Fragen
Ist die Lektion „ROC, AUC und Schwellenwerte“ kostenlos?
Ja — der vollständige Text von „ROC, AUC und Schwellenwerte“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Data Science Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Data Science Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „ROC, AUC und Schwellenwerte“?
Die Rankingqualität über verschiedene Grenzwerte beurteilen Du übst Data Science 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 Data Science Academy zu starten?
Keine Vorkenntnisse erforderlich. Data Science 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 „ROC, AUC und Schwellenwerte“?
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 Data Science Academy-Lektion Code schreiben und ausführen?
Ja. Jede Data Science 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
- Regressionsmetriken: MAE, MSE, R2
- Die Konfusionsmatrix entschlüsselt
- Precision, Recall und F1
- ROC, AUC und Schwellenwerte