官术网_书友最值得收藏!

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. 
主站蜘蛛池模板: 双鸭山市| 濉溪县| 密山市| 平顶山市| 清远市| 崇义县| 德化县| 长葛市| 乐亭县| 当雄县| 江川县| 怀化市| 界首市| 石楼县| 芷江| 沾化县| 商都县| 乐业县| 鹿泉市| 肥东县| 福州市| 巫溪县| 蚌埠市| 宜昌市| 巴中市| 大兴区| 张家港市| 天峻县| 高邑县| 宁城县| 灵丘县| 正蓝旗| 乐陵市| 广元市| 台中市| 富源县| 温泉县| 布尔津县| 延庆县| 揭东县| 庆安县|