ROC、AUC、しきい値
さまざまなしきい値で順位付けの質を評価する
「ROC、AUC、しきい値」はCoddyKit上の無料Data Science Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはData Science Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Data Science Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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. 🎯
よくある質問
「ROC、AUC、しきい値」レッスンは無料ですか?
はい。「ROC、AUC、しきい値」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Data Science Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Data Science Academyコースには全4レッスンが含まれています。
「ROC、AUC、しきい値」で何を学びますか?
さまざまなしきい値で順位付けの質を評価する ブラウザで直接実行するハンズオンコードでData Science Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Data Science Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのData Science Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「ROC、AUC、しきい値」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このData Science Academyレッスンでコードを書いて実行できますか?
はい。すべてのData Science Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 回帰指標:MAE、MSE、R2
- 混同行列を読み解く
- 適合率、再現率、F1
- ROC、AUC、しきい値