Menguraikan Matriks Kebingungan
Positif dan negatif benar maupun salah
Menguraikan Matriks Kebingungan adalah pelajaran Data Science Academy gratis di CoddyKit. Ini adalah pelajaran 2 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Data Science Academy, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Data Science Academy mencakup 4 pelajaran total.
Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.
Beyond a Single Number
For classifiers, one accuracy score hides too much. The confusion matrix lays out exactly which predictions were right and which were wrong. 🧩
A Simple Grid
The matrix is a small grid: rows are the true classes, columns are the predicted ones. Each cell counts how often that pairing happened.
from sklearn.metrics import confusion_matrix
confusion_matrix(y_true, y_pred)True Positives
A true positive is when the model says yes and the answer really is yes. These are the wins you want to maximize.
True Negatives
A true negative is when the model says no and the truth is also no. The model correctly left this case alone.
False Positives
A false positive is a false alarm: the model predicted yes, but the truth was no. Think of flagging a healthy patient as sick.
False Negatives
A false negative is a miss: the model said no while the truth was yes. Picture letting a real fraud slip through unnoticed.
Two Kinds of Mistakes
Notice the two error types differ in cost. A false positive and a false negative are rarely equal, so the matrix keeps them separate.
Where Accuracy Lives
Accuracy is just the correct cells over the total. It is the diagonal divided by everything, which is why it can mask rare errors.
accuracy = (TP + TN) / (TP + TN + FP + FN)Read the Off-Diagonal
The most useful cells sit off the diagonal: they show where the model confuses one class for another, pointing to its weak spots.
See It as a Heatmap
For many classes, plot the matrix as a heatmap. Bright off-diagonal squares instantly reveal which labels get mixed up most.
from sklearn.metrics import ConfusionMatrixDisplay
ConfusionMatrixDisplay.from_predictions(y_true, y_pred)Your Metric Foundation
Almost every classification metric is built from these four counts. Master the confusion matrix and the rest follow naturally.
Quick Check
Let's make sure each cell of the matrix is crystal clear.
Recap
The confusion matrix splits results into true and false, positive and negative. Those four counts power every classification metric. 🎯
Pertanyaan yang Sering Diajukan
Apakah pelajaran “Menguraikan Matriks Kebingungan” gratis?
Ya — teks lengkap “Menguraikan Matriks Kebingungan” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Data Science Academy, upgrade ke CoddyKit PRO. Kursus Data Science Academy mencakup 4 pelajaran total.
Apa yang akan aku pelajari di “Menguraikan Matriks Kebingungan”?
Positif dan negatif benar maupun salah Kamu berlatih Data Science Academy dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.
Apakah aku perlu pengalaman untuk memulai Data Science Academy?
Tidak diperlukan pengalaman sebelumnya. Data Science Academy di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 2 dari 4.
Berapa lama pelajaran “Menguraikan Matriks Kebingungan” memakan waktu?
Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.
Bisakah aku menulis dan menjalankan kode dalam pelajaran Data Science Academy ini?
Ya. Setiap pelajaran Data Science Academy menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.
Semua pelajaran dalam kursus ini
- Metrik Regresi: MAE, MSE, R2
- Menguraikan Matriks Kebingungan
- Precision, Recall, dan F1
- ROC, AUC, dan Ambang Batas