Save sklearn pipeline diagram
Asked Answered
T

1

6

I want to save a pipeline displayed with the set_config(display="diagram") command, see below:

diagram

Is there a better way to do it than by taking a screenshot?

Treillage answered 14/1, 2022 at 17:2 Comment(2)
Perhaps this may help...Prichard
Thanks @amiola, I tried but it gives me the equivalent of what is shown in my Jupyter Notebook, but on a web page. Printing the content of that web page formats it with page number, url and other things that usually come in the frame of printing a web page. Unfortunately I cannot use that in a report.Treillage
C
5
from sklearn.utils import estimator_html_repr

with open("pipeline.html", "w") as f:
    f.write(estimator_html_repr(pipeline))
Concoction answered 16/10, 2022 at 16:53 Comment(1)
This does not answer the question since the OP clearly asks how to create an image without having to take a screenshot. I might add: could it even be saved as a vector graphic?Flanna

© 2022 - 2024 — McMap. All rights reserved.