def test_predict_proba_rocauc(self):
"""
Test ROCAUC with classifiers that utilize predict_proba
"""
# Load the model and assert there is no decision_function method.
model = MultinomialNB()
with self.assertRaises(AttributeError):
model.decision_function
# Fit model and visualizer
visualizer = ROCAUC(model)
visualizer.fit(X, yb)
expected = np.asarray([
[0.493788, 0.506212],
[0.493375, 0.506625],
[0.493572, 0.506428],
[0.511063, 0.488936],
[0.511887, 0.488112],
[0.510841, 0.489158],
])
# Get the predict_proba scores and evaluate
y_scores = visualizer._get_y_scores(X)
npt.assert_array_almost_equal(y_scores, expected)
评论列表
文章目录