plot_similarity

torchhd.utils.plot_similarity(input: Tensor, memory: Tensor, ax=None, **kwargs)[来源]

绘制一个超向量与一组超向量的相似度。

Parameters:
  • input (torch.Tensor) – 用于与内存进行比较的超向量。

  • memory (torch.Tensor) – 一组包含 \(n\) 个超向量的集合。

  • ax (matplotlib.axes, 可选) – 用于绘制图表的坐标轴。

  • **kwargsmatplotlib.axes.Axes.stem 参数。

Returns:

matplotlib.container.StemContainer.

Return type:

StemContainer

Shapes:
  • 输入: \((d)\)

  • 内存:\((n, d)\)

示例:

>>>  import matplotlib.pyplot as plt
>>>  hv = torchhd.level(10, 10000)
>>>  utils.plot_similarity(hv[4], hv)
>>>  plt.show()