Example #1
0
def umap_iplot(x, df_text, preds):
    hover_data = pd.DataFrame({'index': preds, 'label': df_text})
    mapper = umap.UMAP().fit(x)
    p = uplot.interactive(mapper,
                          labels=preds,
                          hover_data=hover_data,
                          point_size=2)
    uplot.show(p)
    return mapper
Example #2
0
 def visualise(self, data):
     mapper = UMAPBase()
     mapper.embedding_ = data[["x", "y"]].values
     p = interactive(mapper,
                     labels=data["class"],
                     hover_data=data,
                     point_size=5,
                     interactive_text_search=False)
     del p.tools[len(p.tools) - 1]
     p.add_tools(get_hovertool())
     p.add_tools(LassoSelectTool())
     p_json = json_item(p)
     return p_json
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_)
Example #4
0
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])