Vertex AI Pipelines には、パイプライン ジョブの結果を評価する事前定義された可視化タイプのセット(Metrics、ClassificationMetrics など)が用意されています。ただし、多くの場合、カスタムの可視化が必要になります。Vertex AI Pipelines では、カスタムの可視化アーティファクトを出力する 2 つの主要な方法(Markdown ファイルと HTML ファイル)が提供されます。
パイプラインの実行を送信すると、 Google Cloud コンソールでこの実行のグラフを表示できます。このグラフには、対応するコンポーネントで宣言した HTML アーティファクトと Markdown アーティファクトが含まれます。これらのアーティファクトを選択して、詳細な可視化の結果を表示できます。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["# Output HTML and Markdown\n\nVertex AI Pipelines provides a set of predefined visualization types\nfor evaluating the result of a pipeline job (for example, `Metrics`,\n`ClassificationMetrics`). However, there are many cases where custom\nvisualization is needed. Vertex AI Pipelines provides two main\napproaches to output custom visualization artifacts: Markdown and HTML files.\n\n### Import required dependencies\n\nIn your development environment import the required dependencies. \n\n from kfp import dsl\n from kfp.dsl import (\n Output,\n HTML,\n Markdown\n )\n\n### Output HTML\n\nTo export an HTML file, define a component with the `Output[HTML]` artifact.\nYou also must write HTML content to the artifact's path. In this example you\nuse a string variable to represent HTML content.\n\n\n| **Note:** HTML and Markdown files are stored under the `pipeline_root` path in Cloud Storage. You must have sufficient permission to the Cloud Storage bucket to view visualization content.\n\n\u003cbr /\u003e\n\n @dsl.component\n def html_visualization(html_artifact: Output[HTML]):\n public_url = 'https://user-images.githubusercontent.com/37026441/140434086-d9e1099b-82c7-4df8-ae25-83fda2929088.png'\n html_content = \\\n '\u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003ch1\u003eGlobal Feature Importance\u003c/h1\u003e\\n\u003cimg src=\"{}\" width=\"97%\"/\u003e\u003c/body\u003e\u003c/html\u003e'.format(public_url)\n with open(html_artifact.path, 'w') as f:\n f.write(html_content)\n\n**HTML artifact in the Google Cloud console:**\n\n**HTML artifact information in the Google Cloud console:**\n\n**Click \"View HTML\" to open HTML file on a new tab**\n\n### Output Markdown\n\nTo export a Markdown file, define a component with the `Output[Markdown]`\nartifact. You also must write Markdown content to the artifact's path. In this\nexample you use a string variable to represent Markdown content.\n\n\n| **Note:** HTML and Markdown files are stored under the `pipeline_root` path in Cloud Storage. You must have sufficient permission to the Cloud Storage bucket to view visualization content.\n\n\u003cbr /\u003e\n\n @dsl.component\n def markdown_visualization(markdown_artifact: Output[Markdown]):\n import urllib.request\n\n with urllib.request.urlopen('https://gist.githubusercontent.com/zijianjoy/a288d582e477f8021a1fcffcfd9a1803/raw/68519f72abb59152d92cf891b4719cd95c40e4b6/table_visualization.md') as table:\n markdown_content = table.read().decode('utf-8')\n with open(markdown_artifact.path, 'w') as f:\n f.write(markdown_content)\n\n**Markdown artifact in the Google Cloud console:**\n\n**Markdown artifact information in the Google Cloud console:**\n\n### Create your pipeline\n\nAfter you have defined your component with the HTML or Markdown artifact create\nand run a pipeline that use the component. \n\n @dsl.pipeline(\n name=f'metrics-visualization-pipeline')\n def metrics_visualization_pipeline():\n html_visualization_op = html_visualization()\n markdown_visualization_op = markdown_visualization()\n\nAfter submitting the pipeline run, you can view the graph for this run in\nthe Google Cloud console. This graph includes the HTML and Markdown artifacts\nyou declared in corresponding components. You can select these artifacts\nto view detailed visualization."]]