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

# ヒストグラム

<Card title="View the source code" href="https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/histogram.py#L18-L94" icon="github" />

wandb のヒストグラム用クラス。

```python theme={null}
Histogram(
    sequence: Optional[Sequence] = None,
    np_histogram: Optional['NumpyHistogram'] = None,
    num_bins: int = 64
) -> None
```

このオブジェクトは numpy のヒストグラム関数と同様に動作します。
[https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html](https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html)

#### 例:

シーケンスからヒストグラムを生成

```python theme={null}
wandb.Histogram([1, 2, 3])
```

np.histogram から効率的に初期化。

```python theme={null}
hist = np.histogram(data)
wandb.Histogram(np_histogram=hist)
```

| Args           | Description                                        |
| :------------- | :------------------------------------------------- |
| `sequence`     | (array\_like) ヒストグラムの入力データ                         |
| `np_histogram` | (numpy histogram) あらかじめ計算されたヒストグラムの代替入力            |
| `num_bins`     | (int) ヒストグラムのビンの数。デフォルトのビンの数は 64 です。ビンの最大数は 512 です |

| Attributes  | Description         |
| :---------- | :------------------ |
| `bins`      | (\[float]) ビンの境界    |
| `histogram` | (\[int]) 各ビンに入る要素の数 |

| Class Variables                   |       |
| :-------------------------------- | :---- |
| `MAX_LENGTH`<a id="MAX_LENGTH" /> | `512` |
