ROC, AUC และค่าเกณฑ์
ประเมินคุณภาพการจัดอันดับในหลายค่าเกณฑ์
ROC, AUC และค่าเกณฑ์ เป็นบทเรียน Data Science Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน 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 และค่าเกณฑ์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Data Science Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Data Science Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “ROC, AUC และค่าเกณฑ์”
ประเมินคุณภาพการจัดอันดับในหลายค่าเกณฑ์ คุณปฏิบัติ Data Science Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Data Science Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Data Science Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “ROC, AUC และค่าเกณฑ์” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Data Science Academy นี้ได้ไหม
ได้ บทเรียน Data Science Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ตัวชี้วัดการถดถอย: MAE, MSE, R2
- ถอดรหัสเมทริกซ์ความสับสน
- ความแม่นยำ ความครอบคลุม และ F1
- ROC, AUC และค่าเกณฑ์