SpectralNet icon indicating copy to clipboard operation
SpectralNet copied to clipboard

Input own similarity matrix?

Open ameya98 opened this issue 6 years ago • 1 comments

Thanks for the implementation. We have a similarity matrix W, and we were wondering if we could use SpectralNet to learn embeddings (in the spectral basis of the associated Laplacian of the similarity matrix). It seems that W is being learned as part of the optimization procedure in SpectralNet, but we want to shortcircuit that.

ameya98 avatar Nov 13 '19 13:11 ameya98

Hi, you can actually create your own n x n affinity matrix as a function of the n inputs to the affinity matrix per batch. See https://github.com/KlugerLab/SpectralNet/blob/43b0fca784491f234489b860fc35832697ad20c2/src/core/networks.py#L108

The easiest reference function you can look at is full_affinity(X, scale), which is used in the first part of the conditional in the referenced part of the python script.

lihenryhfl avatar Mar 03 '20 15:03 lihenryhfl