How to compute Receiving Operating Characteristic (ROC) and AUC in keras?

前端 未结 8 1697
一生所求
一生所求 2020-11-28 02:07

I have a multi output(200) binary classification model which I wrote in keras.

In this model I want to add additional metrics such as ROC and AUC but to my knowledg

相关标签:
8条回答
  • 2020-11-28 02:52

    Adding to above answers, I got the error "ValueError: bad input shape ...", so I specify the vector of probabilities as follows:

    y_pred = model.predict_proba(x_test)[:,1]
    auc = roc_auc_score(y_test, y_pred)
    print(auc)
    
    0 讨论(0)
  • 2020-11-28 02:59

    'roc_curve','auc' are not standard metrics you can't pass them like that to metrics variable, this is not allowed. You can pass something like 'fmeasure' which is a standard metric.

    Review the available metrics here: https://keras.io/metrics/ You may also want to have a look at making your own custom metric: https://keras.io/metrics/#custom-metrics

    Also have a look at generate_results method mentioned in this blog for ROC, AUC... https://vkolachalama.blogspot.in/2016/05/keras-implementation-of-mlp-neural.html

    0 讨论(0)
提交回复
热议问题