Visualize artifacts
Configuring ZenML to display data visualizations in the dashboard.
Visualize artifacts
ZenML automatically saves visualizations of many common data types and allows you to view these visualizations in the ZenML dashboard:
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 or certain numeric numpy arrays,
CSV: Tables, such as the pandas DataFrame
.describe()
output,Markdown: Markdown strings or pages.
Creating Custom Visualizations
There are two ways how you can add custom visualizations to the dashboard:
Visualization via Special Return Types
If you already have HTML, Markdown, or CSV 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.,"# Header\nSome text"
,zenml.types.MarkdownString
for strings in Markdown format, e.g.,"<h1>Header</h1>Some text"
,zenml.types.CSVString
for strings in CSV format, e.g.,"a,b,c\n1,2,3"
.
Example:
This would create the following visualization in the dashboard:
Visualization via Materializers
Visualization via Custom Return Type and Materializer
By combining the ideas behind the above two visualization approaches, you can visualize virtually anything you want inside your ZenML dashboard in three simple steps:
Create a custom class that will hold the data that you want to visualize.
Return your custom class from any of your ZenML steps.
Example: Facets Data Skew Visualization
3. Step There are three different steps in the facets
integration that can be used to create FacetsComparison
s for different sets of inputs. E.g., the facets_visualization_step
below takes two DataFrames as inputs and builds a FacetsComparison
object out of them:
This is what happens now under the hood when you add the facets_visualization_step
into your pipeline:
The step creates and returns a
FacetsComparison
.When the step finishes, ZenML will search for a materializer class that can handle this type, finds the
FacetsMaterializer
, and calls thesave_visualizations()
method which creates the visualization and saves it into your artifact store as an HTML file.When you open your dashboard and click on the artifact inside the run DAG, the visualization HTML file is loaded from the artifact store and displayed.
Disabling Visualizations
If you would like to disable artifact visualization altogether, you can set enable_artifact_visualization
at either pipeline or step level:
Troubleshooting
Configuring Artifact Stores
Last updated