drscotthawley / panotti

A multi-channel neural network audio classifier using Keras
MIT License
271 stars 72 forks source link

Error: "Only one class present in y_true. ROC AUC score is not defined in that case" #35

Open gllort opened 6 years ago

gllort commented 6 years ago

Running the eval_network script I got the following error that arises after the predict phase. What could possibly cause this error? Thanks in advance!

Running predict... Counting mistakes Found 1846 total mistakes out of 16960 attempts Mistakes by class: ... / details of the mistakes follow / ... Measuring ROC...

/apps/K80/PYTHON/3.6.3_ML/lib/python3.6/site-packages/sklearn/metrics/ranking.py:571: UndefinedMetricWarning: No positive samples in y_true, true positive value should be meaningless UndefinedMetricWarning) Traceback (most recent call last): File "./eval_network.py", line 135, in eval_network(weights_file=args.weights, classpath=args.classpath, batch_size=args.batch_size) File "./eval_network.py", line 88, in eval_network auc_score = roc_auc_score(Y_test, y_scores) File "/apps/K80/PYTHON/3.6.3_ML/lib/python3.6/site-packages/sklearn/metrics/ranking.py", line 277, in roc_auc_score sample_weight=sample_weight) File "/apps/K80/PYTHON/3.6.3_ML/lib/python3.6/site-packages/sklearn/metrics/base.py", line 118, in _average_binary_score sample_weight=score_weight) File "/apps/K80/PYTHON/3.6.3_ML/lib/python3.6/site-packages/sklearn/metrics/ranking.py", line 268, in _binary_roc_auc_score raise ValueError("Only one class present in y_true. ROC AUC score " ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.