Keras: Creating AUC/ROC after run.

Created on 14 Oct 2015  Â·  6Comments  Â·  Source: keras-team/keras

Could somebody point me in the right direction of how to do this?

Thank you,

Keiron.

Most helpful comment

y_score = my_model.predict_proba(X_val)

then just use sklearn:
sklearn.metrics.roc_auc_score
sklearn.examples.plot_roc

All 6 comments

y_score = my_model.predict_proba(X_val)

then just use sklearn:
sklearn.metrics.roc_auc_score
sklearn.examples.plot_roc

Thank you :)

On 14 October 2015 at 12:07, Marcin Elantkowski [email protected]
wrote:

preds = my_model.predict_proba(X_val)

then just use sklearn:
sklearn.metrics.roc_auc_score
http://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_auc_score.html#sklearn.metrics.roc_auc_score
sklearn.examples.plot_roc
http://scikit-learn.org/stable/auto_examples/plot_roc.html

—
Reply to this email directly or view it on GitHub
https://github.com/fchollet/keras/issues/832#issuecomment-148019073.

Keiron O'Shea 毛毛
King Abdullah University of Science and Technology
Visiting Research Student, Computational Bioscience Research Center
Ymweld â myfyriwr ymchwil, Chyfrifiannol Canolfan Ymchwil Biowyddoniaeth

Aberystwyth University
PhD Student, Department of Computer Science
Israddedig, Adran o Cyfrifiadureg
[email protected] || KeironTeilo.[email protected] ||
http://users.aber.ac.uk/keo7

When I call fit first I get an error:

for (train, test), color in zip(cv.split(X, y), colors):
    probass = model.fit(X[train], y[train]).predict_proba(X[test])

==> probass = model.fit(X[train], y[train]).predict_proba(X[test])
AttributeError: 'History' object has no attribute 'predict_proba'

If I don't call fit first I get curves, but that seems wrong somehow?
image

I am using Keras 2.0.6. When I used model.fit(X[train], y[train]).predict_proba(X[test]) or model.predict_proba(X[test]), it always said AttributeError: 'Model' object has no attribute 'predict_proba' or 'predict_classes'.
I do not know why. Could you help resolve this problem?
By the way, could I use the model.predict_proba() in any sequence prediction, not just classified prediction.
Thank you very much.

@yelongclass Are you using Functional API? In that case, the method 'predict_proba' doesn't exist.

@kimardenmiller I have exactly the same code and the same issue. As you said without calling model.fit the model is wrong (ie not trained).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KeironO picture KeironO  Â·  3Comments

snakeztc picture snakeztc  Â·  3Comments

amityaffliction picture amityaffliction  Â·  3Comments

harishkrishnav picture harishkrishnav  Â·  3Comments

LuCeHe picture LuCeHe  Â·  3Comments