test_rocauc.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:yellowbrick 作者: DistrictDataLabs 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号