Add pipeline visualizer?
See original GitHub issueWorking 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:
or (with graph_attr={'rankdir': 'LR'}
):
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:
- Created 4 years ago
- Reactions:15
- Comments:17 (13 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If there is interest, I could try to extract the layout engine out into a stand-alone package. It is pure Python.
Here is a 20 minute hacky version in HTML and CSS, just to see if its possible: https://codepen.io/anon/pen/agONqE