OK, thanks for the hints. I have the feeling the continous format error is not because of NaN values. The array does look a bit odd with all the spaces in it.
tpr: [ 0. 0.98547329 1. ]
def new_model(): print(fpr) print(tpr) print(np.argwhere(np.isnan(fpr))) print(np.argwhere(np.isnan(tpr))) auc_roc = roc_auc_score(fpr, tpr) return new_model()fpr: [ 0. 0.98952194 1. ]
tpr: [ 0. 0.98547329 1. ]
Error:ValueError Traceback (most recent call last)
<ipython-input-2-82b3904c67a1> in <module>()
85 #print('auc on validation set {}'.format(auc_roc))
86 return #roc_auc
---> 87 blight_model()
88
89 #The target variable is compliance =
<ipython-input-2-82b3904c67a1> in blight_model()
80
81 #"roc_auc" is a classification or ranking metric, not a regression metric. So it doesn't accept continuous
---> 82 auc_roc = roc_auc_score(fpr, tpr)
83
84
/opt/conda/lib/python3.5/site-packages/sklearn/metrics/ranking.py in roc_auc_score(y_true, y_score, average, sample_weight)
258 return _average_binary_score(
259 _binary_roc_auc_score, y_true, y_score, average,
--> 260 sample_weight=sample_weight)
261
262
/opt/conda/lib/python3.5/site-packages/sklearn/metrics/base.py in _average_binary_score(binary_metric, y_true, y_score, average, sample_weight)
79 y_type = type_of_target(y_true)
80 if y_type not in ("binary", "multilabel-indicator"):
---> 81 raise ValueError("{0} format is not supported".format(y_type))
82
83 if y_type == "binary":
ValueError: continuous format is not supported