Lacak Akurasi Selama Pelatihan
Ubah prediksi menjadi skor
Lacak Akurasi Selama Pelatihan adalah pelajaran Deep Learning Academy gratis di CoddyKit. Ini adalah pelajaran 3 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 Deep Learning Academy, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Deep Learning Academy mencakup 4 pelajaran total.
Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.
Loss Alone Lies a Little
A falling loss feels good, but it is abstract. To know if your model is truly useful you also want accuracy, the share of predictions it gets right. 🎯
From Logits to a Choice
Your model outputs raw scores per class. To pick a prediction you take the index of the largest score with argmax along the class dimension.
preds = pred.argmax(dim=1)Compare to the Truth
Now compare each predicted class to the real label. The result is a boolean tensor where True marks every example the model got right.
correct = preds == yCount the Wins
Booleans add up like ones and zeros, so summing the matches gives a count of correct predictions in this batch.
num_correct = correct.sum().item()Turn Count Into a Rate
Divide correct predictions by the batch size and you get accuracy, a number from zero to one that is easy to read as a percentage.
acc = num_correct / y.size(0)Accumulate Across Batches
Per-batch accuracy is noisy, so keep running totals of correct and seen examples. Their ratio gives a stable epoch accuracy.
total_correct += num_correct
total_seen += y.size(0)Report Each Epoch
At the end of an epoch compute the overall rate and print it beside the loss. Now you see both how confident and how correct the model is.
epoch_acc = total_correct / total_seenKeep Metrics off the Graph
When you only measure, wrap scoring in no_grad. It stops PyTorch from tracking operations you never plan to backpropagate, saving memory.
with torch.no_grad():
preds = model(x).argmax(dim=1)Accuracy Is Not Enough Alone
On imbalanced data accuracy can fool you: always guessing the common class scores high yet learns nothing. Pair it with loss and other metrics.
Watch the Trend
One epoch's number means little; the trend is everything. Rising accuracy with falling loss is the clear sign your training is on track.
A Window Into Learning
Tracking accuracy turns training from a black box into something you can watch. Each epoch you get honest feedback on real progress.
Quick Check
How do you turn class scores into a single predicted label?
Recap
You learned to track accuracy: argmax the scores, compare to labels, count correct, and divide. Watch the trend alongside loss. 🎉
Pertanyaan yang Sering Diajukan
Apakah pelajaran “Lacak Akurasi Selama Pelatihan” gratis?
Ya — teks lengkap “Lacak Akurasi Selama Pelatihan” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Deep Learning Academy, upgrade ke CoddyKit PRO. Kursus Deep Learning Academy mencakup 4 pelajaran total.
Apa yang akan aku pelajari di “Lacak Akurasi Selama Pelatihan”?
Ubah prediksi menjadi skor Kamu berlatih Deep Learning 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 Deep Learning Academy?
Tidak diperlukan pengalaman sebelumnya. Deep Learning 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 3 dari 4.
Berapa lama pelajaran “Lacak Akurasi Selama Pelatihan” 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 Deep Learning Academy ini?
Ya. Setiap pelajaran Deep Learning 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
- Lintasan Maju, Loss, Mundur, Langkah
- Tulis Siklus Pelatihan Minimal
- Lacak Akurasi Selama Pelatihan
- Mode Train vs Eval