> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-1778-mysql-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# クエリパネル

> このページの一部の機能はベータ版であり、機能フラグの後ろに隠れています。関連するすべての機能をアンロックするには、プロフィールページの自己紹介に `weave-plot` を追加してください。

<Note>
  W\&B Weaveをお探しですか？W\&Bの生成AIアプリケーション構築のためのツール群ですか？weaveのドキュメントはここで見つけることができます: [wandb.me/weave](https://wandb.github.io/weave/?utm_source=wandb_docs\&utm_medium=docs\&utm_campaign=weave-nudge).
</Note>

クエリパネルを使用してデータをクエリし、インタラクティブに視覚化します。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/pretty_panel.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=8e9f44e617d2dbfc79a7b6028077b5ad" width="2212" height="1326" data-path="images/weave/pretty_panel.png" />
</Frame>

## クエリパネルを作成する

ワークスペースまたはレポート内にクエリを追加します。

<Tabs>
  <Tab title="Project workspace">
    1. プロジェクトのワークスペースに移動します。
    2. 右上のコーナーにある `Add panel` をクリックします。
    3. ドロップダウンから `Query panel` を選択します。
  </Tab>

  <Tab title="W&B Report">
    `/Query panel` と入力して選択します。

    <Frame>
      <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/add_weave_panel_report_1.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=c2c7b451263c835796694866c7740f2f" width="473" height="370" data-path="images/weave/add_weave_panel_report_1.png" />
    </Frame>

    または、一連の Runs とクエリを関連付けることができます。

    1. レポート内で、`/Panel grid` と入力して選択します。
    2. `Add panel` ボタンをクリックします。
    3. ドロップダウンから `Query panel` を選択します。
  </Tab>
</Tabs>

## クエリコンポーネント

### 式

クエリ式を使用して、W\&Bに保存されたデータ、例えば Runs、Artifacts、Models、Tables などをクエリします。

#### 例: テーブルをクエリする

W\&B Tableをクエリしたいとします。トレーニングコード内で `"cifar10_sample_table"` という名前のテーブルをログします:

```python theme={null}
import wandb
wandb.log({"cifar10_sample_table":<MY_TABLE>})
```

クエリパネル内でテーブルをクエリするには次のようにします:

```python theme={null}
runs.summary["cifar10_sample_table"]
```

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/basic_weave_expression.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=05ba98afcbbe8f880f06a3f5f9a248bb" width="316" height="56" data-path="images/weave/basic_weave_expression.png" />
</Frame>

これを分解すると:

* `runs` は、ワークスペースに Query Panel があるときに自動的に Query Panel Expressions に注入される変数です。その値は、その特定のワークスペースに表示される Runs のリストです。[Run内の利用可能な異なる属性についてはこちらをお読みください](/ja/models/track/public-api-guide/#understanding-the-different-attributes)。
* `summary` は、Run の Summary オブジェクトを返す操作です。Opsは *マップされる* ため、この操作はリスト内の各 Run に適用され、その結果として Summary オブジェクトのリストが生成されます。
* `["cifar10_sample_table"]` は Pick 操作（角括弧で示され）、`predictions` というパラメータを持ちます。Summary オブジェクトは辞書またはマップのように動作するため、この操作は各 Summary オブジェクトから `predictions` フィールドを選択します。

インタラクティブに独自のクエリの書き方を学ぶには、[こちらのレポート](https://wandb.ai/luis_team_test/weave_example_queries/reports/Weave-queries---Vmlldzo1NzIxOTY2?accessToken=bvzq5hwooare9zy790yfl3oitutbvno2i6c2s81gk91750m53m2hdclj0jvryhcr)を参照してください。

### 設定

パネルの左上コーナーにあるギアアイコンを選択してクエリ設定を展開します。これにより、ユーザーはパネルのタイプと結果パネルのパラメータを設定できます。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_panel_config.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=09e7a7f103d7f2beefa915c8bdeceda0" width="1464" height="576" data-path="images/weave/weave_panel_config.png" />
</Frame>

### 結果パネル

最後に、クエリ結果パネルは、選択したクエリパネル、設定によって設定された構成に基づいて、データをインタラクティブに表示する形式でクエリ式の結果をレンダリングします。次の画像は、同じデータのテーブルとプロットを示しています。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/result_panel_table.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=2b9386da941b975799959a3fe7dd7e12" width="1074" height="471" data-path="images/weave/result_panel_table.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/result_panel_plot.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=376f0b34dc63c43cd39fe1d0471298e3" width="1073" height="471" data-path="images/weave/result_panel_plot.png" />
</Frame>

## 基本操作

次に、クエリパネル内で行える一般的な操作を示します。

### ソート

列オプションからソートします:

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_sort.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=b54b6de38d27b7fa1ea27b779bbf697a" width="1072" height="471" data-path="images/weave/weave_sort.png" />
</Frame>

### フィルター

クエリ内で直接、または左上隅のフィルターボタンを使用してフィルターできます（2枚目の画像）。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_filter_1.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=0e33452b5a7420c0d0fa9d336c6f781c" width="1071" height="471" data-path="images/weave/weave_filter_1.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_filter_2.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=e3c1e57162d35010c4c5df725a92a2a9" width="1071" height="470" data-path="images/weave/weave_filter_2.png" />
</Frame>

### マップ

マップ操作はリストを反復し、データ内の各要素に関数を適用します。これは、パネルクエリを使用して直接行うことも、列オプションから新しい列を挿入することによって行うこともできます。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_map.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=168cdafbc270034664e63be64497281e" width="1073" height="471" data-path="images/weave/weave_map.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_map.gif?s=9b2f93fba27606a5d26541383b51e774" width="600" height="269" data-path="images/weave/weave_map.gif" />
</Frame>

### グループ化

クエリを使用してまたは列オプションからグループ化できます。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_groupby.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=0e95982c30dfa66445f66a5e82ae037f" width="1805" height="459" data-path="images/weave/weave_groupby.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_groupby.gif?s=97706c0f8ee1eb3fae463146975060e7" width="600" height="234" data-path="images/weave/weave_groupby.gif" />
</Frame>

### 連結

連結操作により、2つのテーブルを連結し、パネル設定から連結または結合できます。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_concat.gif?s=c235de07a15aec9446d5d90928bd84f6" width="600" height="281" data-path="images/weave/weave_concat.gif" />
</Frame>

### 結合

クエリ内でテーブルを直接結合することも可能です。次のクエリ式を考えてみてください:

```python theme={null}
project("luis_team_test", "weave_example_queries").runs.summary["short_table_0"].table.rows.concat.join(\
project("luis_team_test", "weave_example_queries").runs.summary["short_table_1"].table.rows.concat,\
(row) => row["Label"],(row) => row["Label"], "Table1", "Table2",\
"false", "false")
```

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_join.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=b8d5d0a274fa9f4bd6e0bda760334e3a" width="1804" height="458" data-path="images/weave/weave_join.png" />
</Frame>

左のテーブルは次のように生成されます:

```python theme={null}
project("luis_team_test", "weave_example_queries").\
runs.summary["short_table_0"].table.rows.concat.join
```

右のテーブルは次のように生成されます:

```python theme={null}
project("luis_team_test", "weave_example_queries").\
runs.summary["short_table_1"].table.rows.concat
```

ここで:

* `(row) => row["Label"]` は各テーブルのセレクタであり、結合する列を決定します
* `"Table1"` と `"Table2"` は、結合された各テーブルの名前です
* `true` と `false` は、左および右の内/外部結合設定です

## Runsオブジェクト

クエリパネルを使用して `runs` オブジェクトにアクセスします。Runオブジェクトは、実験の記録を保存します。詳細については、[こちらのレポート](https://wandb.ai/luis_team_test/weave_example_queries/reports/Weave-queries---Vmlldzo1NzIxOTY2?accessToken=bvzq5hwooare9zy790yfl3oitutbvno2i6c2s81gk91750m53m2hdclj0jvryhcr#3.-accessing-runs-object)のセクションを参照してくださいが、簡単な概要として、`runs` オブジェクトには以下が含まれます:

* `summary`: Runの結果を要約する情報の辞書です。精度や損失のようなスカラーや、大きなファイルを含むことができます。デフォルトでは、`wandb.log()`は記録された時系列の最終的な値をsummaryに設定します。直接summaryの内容を設定することもできます。summaryはRunの出力と考えてください。
* `history`: モデルがトレーニング中に変化する値を格納するための辞書のリストです。コマンド `wandb.log()` はこのオブジェクトに追加します。
* `config`: Runの設定情報を含む辞書で、トレーニングランのハイパーパラメーターやデータセットアーティファクトを作成するランの前処理方法などが含まれます。これらはRunの「入力」として考えてください。

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_runs_object.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=43a2d1558db22fa94e515fb3cc1af78a" width="1797" height="427" data-path="images/weave/weave_runs_object.png" />
</Frame>

## Artifactsにアクセスする

Artifacts は W\&B の中核概念です。これは、バージョン管理された名前付きファイルやディレクトリーのコレクションです。Artifacts を使用して、モデルの重み、データセット、およびその他のファイルやディレクトリーを追跡します。Artifacts は W\&B に保存され、他の runs でダウンロードまたは使用できます。詳細と例は、[こちらのセクション](https://wandb.ai/luis_team_test/weave_example_queries/reports/Weave-queries---Vmlldzo1NzIxOTY2?accessToken=bvzq5hwooare9zy790yfl3oitutbvno2i6c2s81gk91750m53m2hdclj0jvryhcr#4.-accessing-artifacts)のレポートで確認できます。Artifacts は通常、`project` オブジェクトからアクセスします:

* `project.artifactVersion()`: プロジェクト内の特定の名前とバージョンのアーティファクトバージョンを返します
* `project.artifact("")`: プロジェクト内の特定の名前のアーティファクトを返します。その後、`.versions` を使用してこのアーティファクトのすべてのバージョンのリストを取得できます
* `project.artifactType()`: プロジェクト内の特定の名前の `artifactType` を返します。その後、`.artifacts` を使用して、このタイプを持つすべてのアーティファクトのリストを取得できます
* `project.artifactTypes`: プロジェクト内のすべてのアーティファクトタイプのリストを返します

<Frame>
  <img src="https://mintcdn.com/wb-21fd5541-docs-1778-mysql-updates/--PmGmjVu-a1PxdK/images/weave/weave_artifacts.png?fit=max&auto=format&n=--PmGmjVu-a1PxdK&q=85&s=d94b2bcfe1e357a66fbbdc8ff90ccf7b" width="1798" height="662" data-path="images/weave/weave_artifacts.png" />
</Frame>
