test_rocauc.py 文件源码

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

项目:yellowbrick 作者: DistrictDataLabs 项目源码 文件源码
def test_decision_function_rocauc(self):
        """
        Test ROCAUC with classifiers that have a decision function
        """
        # Load the model and assert there is no predict_proba method.
        model = LinearSVC()
        with self.assertRaises(AttributeError):
            model.predict_proba

        # Fit model and visualizer
        visualizer = ROCAUC(model)
        visualizer.fit(X, yb)

        expected = np.asarray([
            0.204348,  0.228593,  0.219908, -0.211756, -0.26155 , -0.221405
        ])

        # Get the predict_proba scores and evaluate
        y_scores = visualizer._get_y_scores(X)
        npt.assert_array_almost_equal(y_scores, expected, decimal=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号