def test_draw_visualizer_grid(self): """ Draw a 4 visualizers grid with default options """ visualizers = [ RandomVisualizer(random_state=(1 + x)**2) for x in range(4) ] X, y = make_classification(random_state=78) grid = VisualizerGrid(visualizers) grid.fit(X, y) # show is required here (do not replace with finalize)! assert grid.show() is not None self.assert_images_similar(grid, tol=1.0)
def test_draw_with_cols(self): """ Draw 2 visualizers in their own column """ visualizers = [ RandomVisualizer(random_state=633), RandomVisualizer(random_state=336), ] X, y = make_classification(random_state=187) grid = VisualizerGrid(visualizers, ncols=2) grid.fit(X, y) grid.poof() self.assert_images_similar(grid)
def test_draw_visualizer_grid(self): """ Draw a 4 visualizers grid with default options """ visualizers = [ RandomVisualizer(random_state=(1+x)**2) for x in range(4) ] X, y = make_classification(random_state=78) grid = VisualizerGrid(visualizers) grid.fit(X, y) grid.poof() self.assert_images_similar(grid)
def test_draw_with_cols(self): """ Draw 2 visualizers in their own column """ visualizers = [ RandomVisualizer(random_state=633), RandomVisualizer(random_state=336), ] X, y = make_classification(random_state=187) grid = VisualizerGrid(visualizers, ncols=2) grid.fit(X, y) # show is required here (do not replace with finalize)! assert grid.show() is not None self.assert_images_similar(grid, tol=1.0)
def test_draw_with_rows(self): """ Draw 2 visualizers in their own row """ visualizers = [ RandomVisualizer(random_state=63), RandomVisualizer(random_state=36), ] X, y = make_classification(random_state=87) grid = VisualizerGrid(visualizers, nrows=2) grid.fit(X, y) # poof is required here (do not replace with finalize)! assert grid.poof() is not None self.assert_images_similar(grid)
def test_draw_visualizer_grid(self): """ Draw a 4 visualizers grid with default options """ visualizers = [ RandomVisualizer(random_state=(1 + x)**2) for x in range(4) ] X, y = make_classification(random_state=78) grid = VisualizerGrid(visualizers) grid.fit(X, y) grid.poof() self.assert_images_similar(grid)
def test_cant_define_both_rows_cols(self): """ Assert that both nrows and ncols cannot be specified """ with pytest.raises(YellowbrickValueError): VisualizerGrid([], ncols=2, nrows=2)