model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=[MyMetric])此外,tf.metrics.auc返回一个包含张量和update_op的元组. Keras希望自定义指标功能仅返回张量.Also, tf.metrics.auc returns a tuple containing the tensor and update_op. Keras expects the custom metric function to return only a tensor.def MyMetric(yTrue, yPred): import tensorflow as tf auc = tf.metrics.auc(yTrue, yPred) return auc[0]在此步骤之后,您将获得有关未初始化值的错误.请查看以下主题:After this step, you will get errors about uninitialized values. Please see these threads: https://github.com/keras-team/keras/issues/3230 如何计算接收运行特征( ROC)和keras中的AUC? 这篇关于如何基于AUC指标在Keras中保存最佳模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-29 14:50