Two solutions for using AUC-ROC to train keras models, proposed here worked for me. But using tensorflow or scikit rocauc functions I get different results.
def auc(y_true, y_pred):
auc = tf.metrics.auc(y_true, y_pred)[1]
K.get_session().run(tf.local_variables_initializer())
return auc
and
def auc(y_true, y_pred):
return tf.py_func(roc_auc_score, (y_true, y_pred), tf.double)
Based on the history, it looks like both are being applied to train and validation. When I plot history metrics, tensorflow curve looks very smoothed compared to scikit.
Shouldn't I get about the same results using both functions?