plot_similarity
- torchhd.utils.plot_similarity(input: Tensor, memory: Tensor, ax=None, **kwargs)[source]
Plots the similarity of an one hypervector with a set of hypervectors.
- Parameters:
input (torch.Tensor) – Hypervector to compare against the memory.
memory (torch.Tensor) – Set of \(n\) hypervectors.
ax (matplotlib.axes, optional) – Axes in which to draw the plot.
**kwargs – matplotlib.axes.Axes.stem arguments.
- Returns:
- Return type:
StemContainer
- Shapes:
Input: \((d)\)
Memory: \((n, d)\)
Examples:
>>> import matplotlib.pyplot as plt >>> hv = torchhd.level(10, 10000) >>> utils.plot_similarity(hv[4], hv) >>> plt.show()