GNUD
GNUD copied to clipboard
got error when calculate roc_auc_scores
Hi, it's excellent work. But I always got this error even though I tried a lot of ways.
"Input contains NaN, infinity or a value too large for dtype('float32')."
~\PycharmProjects\GNUD\model.py in eval(self, sess, feed_dict)
399 scores[np.isnan(scores)] = scores.mean()
400 scores[np.isfinite(scores)] = scores.mean()
--> 401 auc = roc_auc_score(y_true=labels, y_score=scores)
402 f1 = f1_score(labels, predict)
403
~\anaconda3\envs\tensorflow\lib\site-packages\sklearn\metrics\_ranking.py in roc_auc_score(y_true, y_score, average, sample_weight, max_fpr, multi_class, labels)
544 y_type = type_of_target(y_true)
545 y_true = check_array(y_true, ensure_2d=False, dtype=None)
--> 546 y_score = check_array(y_score, ensure_2d=False)
~\anaconda3\envs\tensorflow\lib\site-packages\sklearn\utils\validation.py in _assert_all_finite(X, allow_nan, msg_dtype)
112 ):
113 type_err = "infinity" if allow_nan else "NaN, infinity"
--> 114 raise ValueError(
115 msg_err.format(
116 type_err, msg_dtype if msg_dtype is not None else X.dtype
ValueError: Input contains NaN, infinity or a value too large for dtype('float32').