paddle计算cost和auc的原理
Created by: zds9204
请教,paddle如何计算cost和auc?我的训练输出如下:cost在跳跃,auc却绝大部份时候都在稳定上升。是和auc的计算方式有关系吗?这个值可信吗?还有就是每次做完测试,下面的训练步骤中,auc会稍稍降低一点
Pass 1, batch 1909, cost 0.19247454, auc 0.6434270107163857 Pass 1, batch 1919, cost 0.22812182, auc 0.6434267787963717 Pass 1, batch 1929, cost 0.24577512, auc 0.6434510845627743 Pass 1, batch 1939, cost 0.20186093, auc 0.643460327533481 Pass 1, batch 1949, cost 0.22698459, auc 0.6435032802800212 Pass 1, batch 1959, cost 0.19867998, auc 0.6435776448961714 Pass 1, batch 1969, cost 0.16872633, auc 0.6435772155782321 Pass 1, batch 1979, cost 0.22229147, auc 0.6436030926709777 Pass 1, batch 1989, cost 0.22751878, auc 0.6436795211141892 Pass 1, batch 1999, cost 0.16602051, auc 0.643698203486087 Test with Pass 1, batch 1999, cost 0.16868488, auc 0.6425449517748172 Pass 1, batch 2009, cost 0.17661315, auc 0.641565554032737 Pass 1, batch 2019, cost 0.19275923, auc 0.6415964804081982 Pass 1, batch 2029, cost 0.18021822, auc 0.641636031573152 Pass 1, batch 2039, cost 0.18022606, auc 0.641631451746716
我的计算代码如下:
predict = layers.fc(input=combined, size=2, act="softmax")
label = layers.data(name='label', shape=[1], dtype='int64')
auc_var, cur_auc_var = fluid.layers.auc(
input=predict, label=label, num_thresholds=2 ** 12)
cost = layers.cross_entropy(input=predict, label=label)
avg_cost = layers.mean(cost)
return predict, avg_cost, auc_var