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

# 2つの異なる時間スケールでメトリクスをログできますか？

たとえば、バッチごとにトレーニング精度を、エポックごとに検証精度をログしたいとします。

はい。メトリクスとあわせて、`batch` や `epoch` のようなインデックスもログしてください。1つの step では `wandb.Run.log()({'train_accuracy': 0.9, 'batch': 200})` を使用し、別の step では `wandb.Run.log()({'val_accuracy': 0.8, 'epoch': 4})` を使用します。UI で、各チャートの x-axis に使用したい値を設定します。特定のインデックスのデフォルトの x-axis を設定するには、[Run.define\_metric()](/ja/models/ref/python/experiments/run#define_metric) を使用します。この例では、次のコードを使用します。

```python theme={null}
import wandb

with wandb.init() as run:
   run.define_metric("batch")
   run.define_metric("epoch")

   run.define_metric("train_accuracy", step_metric="batch")
   run.define_metric("val_accuracy", step_metric="epoch")
```

***

<Badge stroke shape="pill" color="orange" size="md">[Experiments](/ja/support/models/tags/experiments)</Badge><Badge stroke shape="pill" color="orange" size="md">[メトリクス](/ja/support/models/tags/metrics)</Badge>
