Input own similarity matrix?
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.
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.