test_boundaries.py 文件源码

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

项目:yellowbrick 作者: DistrictDataLabs 项目源码 文件源码
def test_draw_ax_show_scatter_False(self):
        """Test that the matplotlib functions are being called when the
        scatter plot isn't drawn
        """
        model = neighbors.KNeighborsClassifier(3)
        viz = DecisionBoundariesVisualizer(
            model, features=['one', 'two'], show_scatter=False)
        fitted_viz = viz.fit(X_two_cols, y=y)
        fitted_viz.ax = mock.Mock()
        fitted_viz.ax.pcolormesh = mock.MagicMock()
        fitted_viz.ax.scatter = mock.MagicMock()
        fitted_viz.ax.legend = mock.MagicMock()

        fitted_viz.draw(X_two_cols, y=y)
        self.assertEquals(len(fitted_viz.ax.pcolormesh.mock_calls), 1)
        self.assertEquals(len(fitted_viz.ax.scatter.mock_calls), 0)
        self.assertEquals(len(fitted_viz.ax.legend.mock_calls), 1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号