question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add pipeline visualizer?

See original GitHub issue

Working with more complex pipelines and ColumnTransformer it can be a bit hard to visualize what’s going on. I think it would be nice to have a way to visualize the estimator graph. Unfortunately this will be tricky without using graphviz. With graphviz, it’s pretty easy though.

on the column transformer example this produces: image

or (with graph_attr={'rankdir': 'LR'}): image

I’ll put this into dabl for sure, but might also be interesting for sklearn, I think. This is obviously just a hack and we could make this much nicer, for example with graphviz records. But even better would be avoiding graphviz.

def pipe_to_viz(est, name_from_parent=None, parent=None, **kwargs):
    # graph is not actually used in the singleton case
    # unless there's no parent (and it's not actually a graph)
    if name_from_parent is None:
        graph = Digraph("Some Pipeline", **kwargs)
    else:
        graph = Digraph("cluster " + name_from_parent, **kwargs)
        graph.attr(color='grey')
        graph.attr(label=name_from_parent)
    graph.attr(compound='true')

    if isinstance(est, Pipeline):
        prev_step = None
        prev_sub = None
        for step in est.steps:
            sub, node = pipe_to_viz(step[1], name_from_parent=step[0], parent=graph)
            graph.subgraph(sub)
            if prev_step is not None:
                ltail = getattr(prev_sub, 'name', None)
                lhead = getattr(sub, 'name', None)
                graph.edge(prev_step, node, ltail=ltail, lhead=lhead)


            prev_step = node
            prev_sub = sub
        return graph, node
    elif isinstance(est, ColumnTransformer):
        graph.node("out", shape="point")
        for trans in est.transformers:
            sub, node = pipe_to_viz(trans[1], name_from_parent=trans[0], parent=graph)
            graph.subgraph(sub)
            ltail = getattr(sub, 'name', None)
            graph.edge(node, 'out', ltail=ltail)
        return graph, "out"
    else:
        label = est.__class__.__name__
        node = label + "_" + str(np.random.randint(10000))
        if parent is None:
            graph.node(node, label=label, shape='box')
            return graph, node
        # we could draw boxes around each estimator with the name
        # or we could use the name in  the label? hm
        parent.node(node, label=label, shape='box')
        return None, node

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:17 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
mitarcommented, Jul 24, 2019

If there is interest, I could try to extract the layout engine out into a stand-alone package. It is pure Python.

3reactions
thomasjpfancommented, Jun 12, 2019

Here is a 20 minute hacky version in HTML and CSS, just to see if its possible: https://codepen.io/anon/pen/agONqE

Screen Shot 2019-06-12 at 2 22 37 PM
Read more comments on GitHub >

github_iconTop Results From Across the Web

Pipeline visualization | Microsoft Learn
It helps users to track the input/output of each step and can be used for sanity check of the features, especially for complicated...
Read more >
jenkins-x/jx-pipelines-visualizer - GitHub
This is a Web UI for Jenkins X, with a clear goal: visualize the pipelines - and their logs. Pipeline View. Features. View...
Read more >
Pipeline Editor - GitLab Docs
To view a visualization of your .gitlab-ci.yml configuration, in your project, go to CI/CD > Editor, and then select the Visualize tab. The...
Read more >
New UI to visualize your pipelines and logs - Jenkins X
jx-pipelines-visualizer is a new open-source UI from the community, to visualize the pipelines and logs.
Read more >
Yet Another Build Visualizer - Jenkins Plugins
Since the full chain is shown, the plugin provides easy and fast navigation between all executed builds in the pipeline. Sports nice and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found