4

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?

Joris Limonier
  • 681
  • 1
  • 10
  • 27
  • 1
    Perhaps [this](https://scikit-learn.org/stable/modules/compose.html#visualizing-composite-estimators) may help... – amiola Jan 14 '22 at 17:17
  • 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. – Joris Limonier Jan 14 '22 at 17:31

1 Answers1

2
from sklearn.utils import estimator_html_repr

with open("pipeline.html", "w") as f:
    f.write(estimator_html_repr(pipeline))
Benjamin Breton
  • 1,388
  • 1
  • 13
  • 42