- Deep Learning Quick Reference
- Mike Bernico
- 203字
- 2021-06-24 18:40:16
Using metrics to assess the performance
In addition to a loss function, Keras lets us also use metrics to help judge the performance of a model. While minimizing loss is good, it's not especially obvious how we expect the model to perform given some loss function. Metrics aren't used in training the model, they're just there to help us understand the current state.
While loss might not mean much to us, accuracy does. We humans understand accuracy fairly well.
Keras defines binary accuracy as follows:
def binary_accuracy(y_true, y_pred):
return K.mean(K.equal(y_true, K.round(y_pred)), axis=-1)
This is really just a clever way to simply divide the number of correct answers by the total answers, as we've likely been doing since our very early days in school to figure out our grade on a test.
You might be wondering whether our dataset is balanced because accuracy works so poorly for unbalanced datasets. It's in fact not balanced. Only one-fifth of the dataset is class 1. We will calculate the ROC AUC score as a custom callback to address this. ROC isn't implemented in Keras as a metric because metrics are computed for every mini batch and the ROC AUC score isn't really defined by mini batch.
推薦閱讀
- 輕輕松松自動化測試
- 自主研拋機器人技術
- AutoCAD 2012中文版繪圖設計高手速成
- Storm應用實踐:實時事務處理之策略
- MATLAB/Simulink權威指南:開發環境、程序設計、系統仿真與案例實戰
- TensorFlow Reinforcement Learning Quick Start Guide
- INSTANT Puppet 3 Starter
- Mastering Ceph
- ASP.NET 2.0 Web開發入門指南
- ZigBee無線通信技術應用開發
- 機床電氣控制與PLC
- 生成對抗網絡項目實戰
- Apache Spark Quick Start Guide
- EJB JPA數據庫持久層開發實踐詳解
- 渲染王3ds Max三維特效動畫技術