Visualizations
Learn how to visualize the data artifacts produced by your ZenML pipelines.
Last updated
Was this helpful?
Learn how to visualize the data artifacts produced by your ZenML pipelines.
Last updated
Was this helpful?
Data visualization is a powerful tool for understanding your ML pipeline outputs. ZenML provides built-in capabilities to visualize artifacts, helping you gain insights into your data, model performance, and pipeline execution.
ZenML automatically generates visualizations for many common data types, making it easy to inspect your artifacts without additional code.
The ZenML dashboard displays visualizations for artifacts produced by your pipeline runs:
To view visualizations in the dashboard:
Navigate to the Runs tab
Select a specific pipeline run
Click on any step to view its outputs
Select an artifact to view its visualizations
You can also display artifact visualizations in Jupyter notebooks using the visualize()
method:
ZenML supports visualizations for many common data types out of the box:
It is simple to associate a custom visualization with an artifact in ZenML, if the visualization is one of the supported visualization types. Currently, the following visualization types are supported:
HTML: Embedded HTML visualizations such as data validation reports,
Image: Visualizations of image data such as Pillow images (e.g. PIL.Image
) or certain numeric numpy arrays,
CSV: Tables, such as the pandas DataFrame .describe()
output,
Markdown: Markdown strings or pages.
JSON: JSON strings or objects.
There are three ways how you can add custom visualizations to the dashboard:
If you already have HTML, Markdown, CSV or JSON data available as a string inside your step, you can simply cast them to one of the following types and return them from your step:
zenml.types.HTMLString
for strings in HTML format, e.g., "<h1>Header</h1>Some text"
,
zenml.types.MarkdownString
for strings in Markdown format, e.g., "# Header\nSome text"
,
zenml.types.CSVString
for strings in CSV format, e.g., "a,b,c\n1,2,3"
.
zenml.types.JSONString
for strings in JSON format, e.g., {"key": "value"}
.
This would create the following visualization in the dashboard:
Another example is visualizing a matplotlib plot by embedding the image in an HTML string:
1. Custom Class First, we create a custom class to hold our matplotlib figure:
3. Step Finally, we create a step that returns our custom type:
In order for the visualizations to show up on the dashboard, the following must be true:
You can control whether visualizations are generated at the pipeline or step level:
You can also configure this in YAML:
Visualizing artifacts is a powerful way to gain insights from your ML pipelines. ZenML's built-in visualization capabilities make it easy to understand your data and model outputs, identify issues, and communicate results.
By leveraging these visualization tools, you can better understand your ML workflows, debug problems more effectively, and make more informed decisions about your models.
A statistical representation of a Dataframe represented as a png image.
Drift detection reports by , , and .
A datasets viewer embedded as a HTML iframe.
If you are already handling HTML, Markdown, CSV or JSON data in one of your steps, you can have them visualized in just a few lines of code by casting them to a inside your step.
If you want to automatically extract visualizations for all artifacts of a certain data type, you can define type-specific visualization logic by .
If you want to automatically extract visualizations for all artifacts of a certain data type, you can do so by overriding the save_visualizations()
method of the corresponding . Let's look at an example of how to visualize matplotlib figures in your ZenML dashboard:
2. Materializer Next, we create a that handles this class and implements the visualization logic:
For another example, see our which visualizes datasets by embedding their preview viewer.
Visualizations are usually stored alongside the artifact, in the . Therefore, if a user would like to see the visualization displayed on the ZenML dashboard, they must give access to the server to connect to the artifact store.
The documentation goes deeper into the concept of service connectors and how they can be configured to give the server permission to access the artifact store. For a concrete example, see the artifact store documentation.
If all visualizations of a certain pipeline run are not showing up in the dashboard, it might be that your ZenML server does not have the required dependencies or permissions to access that artifact store. See the for more information.