google-deepmind / spectral_inference_networks

Implementation of Spectral Inference Networks, ICLR 2019
Apache License 2.0
170 stars 30 forks source link

spin_test.py unexpected behavior? #2

Closed bohan-li closed 3 years ago

bohan-li commented 3 years ago

Hi, I'm was running spin_test.py to get a basic understanding for how spin works and I noticed that it seems to be consistently finding the smallest magnitude eigenvalues rather than the largest. Is this expected behavior? I thought the paper specified that the goal of spin was to find the top N eigenfunctions? If it is expected behavior, is there a way to reverse the problem formulation to get the largest rather than smallest?

I was running spin_test with random seed 0 with matrices of size 10, and finding 5 eigenfunctions.

Actual eigenvalues: image

Calculated eigenvalues: image

dpfau commented 3 years ago

It is meant to find the smallest, not largest. You could simply put a minus sign in front of the loss to get the largest. While this will work fine for finite matrices, I would not recommend it for linear operators (and I would not recommend using SpIN for finite matrices for anything other than sanity checks).

On Wed, Feb 17, 2021 at 11:36 AM bohan-li notifications@github.com wrote:

Hi, I'm was running spin_test.py to get a basic understanding for how spin works and I noticed that it seems to be consistently finding the smallest magnitude eigenvalues rather than the largest. Is this expected behavior? I thought the paper specified that the goal of spin was to find the top N eigenfunctions? If it is expected behavior, is there a way to reverse the problem formulation to get the largest rather than smallest?

I was running spin_test with random seed 0 with matrices of size 10, and finding 5 eigenfunctions.

Actual eigenvalues: [image: image] https://user-images.githubusercontent.com/27116406/108198805-528b3100-70d9-11eb-879d-760b54e75a1d.png

Calculated eigenvalues: [image: image] https://user-images.githubusercontent.com/27116406/108198911-78b0d100-70d9-11eb-9518-e650bd452c50.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deepmind/spectral_inference_networks/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDACGMS72F3NTVA3WQ4LDS7OS33ANCNFSM4XYGD4VA .

bohan-li commented 3 years ago

Thank you for your quick response!