def _plot_embedings(self, logger, epoch, embeddings, targets, outputs): from umap import plot fig_gt = plot.points(embeddings, labels=targets, **self._plot_params).figure fig_gt = render_figure_to_tensor(fig_gt) logger.add_image(f"{self.prefix}/gt/epoch", fig_gt, global_step=epoch) fig_pred = plot.points(embeddings, labels=outputs, **self._plot_params).figure fig_pred = render_figure_to_tensor(fig_pred) logger.add_image(f"{self.prefix}/pred/epoch", fig_pred, global_step=epoch)
def test_plot_runs_at_all(mapper, iris): from umap import plot as umap_plot umap_plot.points(mapper) umap_plot.points(mapper, labels=iris.target) umap_plot.points(mapper, values=iris.data[:, 0]) umap_plot.points(mapper, theme="fire") umap_plot.diagnostic(mapper, diagnostic_type="all") umap_plot.diagnostic(mapper, diagnostic_type="neighborhood") umap_plot.connectivity(mapper) umap_plot.interactive(mapper) umap_plot.interactive(mapper, labels=iris.target) umap_plot.interactive(mapper, values=iris.data[:, 0]) umap_plot.interactive(mapper, theme="fire") umap_plot._datashade_points(mapper.embedding_)
def test_plot_runs_at_all(mapper, iris, iris_selection): from umap import plot as umap_plot umap_plot.points(mapper) umap_plot.points(mapper, labels=iris.target) umap_plot.points(mapper, values=iris.data[:, 0]) umap_plot.points(mapper, labels=iris.target, subset_points=iris_selection) umap_plot.points(mapper, values=iris.data[:, 0], subset_points=iris_selection) umap_plot.points(mapper, theme="fire") umap_plot.diagnostic(mapper, diagnostic_type="all") umap_plot.diagnostic(mapper, diagnostic_type="neighborhood") umap_plot.connectivity(mapper) umap_plot.connectivity(mapper, theme="fire") umap_plot.connectivity(mapper, edge_bundling="hammer") umap_plot.interactive(mapper) umap_plot.interactive(mapper, labels=iris.target) umap_plot.interactive(mapper, values=iris.data[:, 0]) umap_plot.interactive(mapper, labels=iris.target, subset_points=iris_selection) umap_plot.interactive(mapper, values=iris.data[:, 0], subset_points=iris_selection) umap_plot.interactive(mapper, theme="fire") umap_plot._datashade_points(mapper.embedding_) umap_plot._datashade_points(mapper.embedding_, labels=iris.target) umap_plot._datashade_points(mapper.embedding_, values=iris.data[:, 0])