> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# カスタム チャートの概要

> W&B Python SDK のカスタム チャートを使用して、project のダッシュボードにインタラクティブな可視化を作成します

W\&B のカスタム チャートは、`wandb.plot` namespace にある一連の関数を使用してプログラムで作成できます。これらの関数は W\&B プロジェクトのダッシュボードにインタラクティブな可視化を作成し、混同行列、ROC 曲線、分布プロットなど、ML で一般的な可視化をサポートしています。

<h2 id="available-chart-functions">
  利用可能なチャート関数
</h2>

| 関数 | 説明 |
| - | - |
| [`confusion_matrix()`](/ja/products/wandb/ref/python/custom-charts/confusion_matrix) | 分類のパフォーマンスを可視化する混同行列を生成します。 |
| [`roc_curve()`](/ja/products/wandb/ref/python/custom-charts/roc_curve) | 二値分類器および多クラス分類器の ROC (Receiver Operating Characteristic) 曲線を作成します。 |
| [`pr_curve()`](/ja/products/wandb/ref/python/custom-charts/pr_curve) | 分類器を評価するための適合率-再現率 (Precision-Recall) 曲線を作成します。 |
| [`line()`](/ja/products/wandb/ref/python/custom-charts/line) | 表形式のデータから折れ線グラフを作成します。 |
| [`scatter()`](/ja/products/wandb/ref/python/custom-charts/scatter) | 変数間の関係を示す散布図を作成します。 |
| [`bar()`](/ja/products/wandb/ref/python/custom-charts/bar) | カテゴリデータの棒グラフを生成します。 |
| [`histogram()`](/ja/products/wandb/ref/python/custom-charts/histogram) | データの分布を分析するためのヒストグラムを作成します。 |
| [`line_series()`](/ja/products/wandb/ref/python/custom-charts/line_series) | 1 つのチャートに複数の折れ線系列をプロットします。 |
| [`plot_table()`](/ja/products/wandb/ref/python/custom-charts/plot_table) | Vega-Lite の spec を使用してカスタム チャートを作成します。 |

<h2 id="common-use-cases">
  一般的なユースケース
</h2>

<h3 id="model-evaluation">
  モデル評価
</h3>

* **分類**: 分類器の評価には `confusion_matrix()`、`roc_curve()`、`pr_curve()` を使用します
* **回帰**: 予測値と実測値の比較プロットには `scatter()`、残差分析には `histogram()` を使用します
* **Vega-Lite チャート**: ドメイン固有の可視化には `plot_table()` を使用します

<h3 id="training-monitoring">
  トレーニングのモニタリング
</h3>

* **学習曲線**: エポックごとのメトリクスをトラッキングするには、`line()` または `line_series()` を使用します
* **ハイパーパラメーターの比較**: 設定を比較するには、`bar()` チャートを使用します

<h3 id="data-analysis">
  データ分析
</h3>

* **分布分析**: `histogram()` で特徴量の分布を確認します
* **相関分析**: `scatter()` プロットで変数間の関係を確認します

<h2 id="getting-started">
  はじめに
</h2>

<h3 id="log-a-confusion-matrix">
  混同行列をログする
</h3>

```python theme={"system"}
import wandb

y_true = [0, 1, 2, 0, 1, 2]
y_pred = [0, 2, 2, 0, 1, 1]
class_names = ["class_0", "class_1", "class_2"]

# run を初期化する
with wandb.init(project="custom-charts-demo") as run:
    run.log({
        "conf_mat": wandb.plot.confusion_matrix(
            y_true=y_true, 
            preds=y_pred,
            class_names=class_names
        )
    })
```

<h3 id="build-a-scatter-plot-for-feature-analysis">
  特徴量分析用の散布図を作成する
</h3>

```python theme={"system"}
import numpy as np

# 合成データを生成
data_table = wandb.Table(columns=["feature_1", "feature_2", "label"])

with wandb.init(project="custom-charts-demo") as run:

    for _ in range(100):
        data_table.add_data(
            np.random.randn(), 
            np.random.randn(), 
            np.random.choice(["A", "B"])
        )

    run.log({
        "feature_scatter": wandb.plot.scatter(
            data_table, x="feature_1", y="feature_2",
            title="Feature Distribution"
        )
    })

```


## Related topics

- [カスタム チャートの概要](/ja/products/wandb/app/features/custom-charts.md)
