Diffusion based distances in PyTorch
Project description
heatdist
Implementation of diffusion-based distances in torch.
from torchheat.heat_kernel import HeatKernelGaussian, HeatKernelKNN
import torch
data = torch.randn(100, 5)
# Heat kernel for a gaussian affinity matrix
heat_op = HeatKernelGaussian(sigma=1.0, t=1.0)
dist = heat_op.fit(data, dist_type="var") # ["var", "phate", "diff"]
# Heat kernel for a k-nearest neighbor affinity matrix
heat_op = HeatKernelKNN(k=5, t=1.0)
dist = heat_op.fit(data, dist_type="var") # ["var", "phate", "diff"]
Below is an example of distance matrices from a line embedded in two dimensions. The Euclidean distance between the two sets of points highlighted in green does not reflect the true distances on the one dimensional line.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchheat-0.1.0.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for torchheat-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0eaa49d976bfeaaf6fd179de8abe5dc6e5bd5c07f281d23873440fd23ed4e15 |
|
MD5 | 9caddf5ce560f9a648dad282419059ff |
|
BLAKE2b-256 | 6b83c5f6f904d3e437bf5aa95bce9e33d97ccad49c3f59ca40e1dda4432712cf |