igraph / xdata-igraph

xdata igraph, has been merged into igraph/igraph
GNU General Public License v2.0
18 stars 3 forks source link

ASE, with largest/smallest algebraic eigenvalue #42

Closed gaborcsardi closed 10 years ago

gaborcsardi commented 10 years ago

Daniel:

Right now it seems like igraph is taking the svd of A and returns the embedding corresponding to the largest eigenvalues in magnitude. Sometimes we want the largest eigenvalues in the algebraic ordering (at least for undirected graphs) and for some of the laplacians we want the smallest algebraic.

From #38.

gaborcsardi commented 10 years ago

Actually, right now the algebraic largest eigenvalue is used....

dpmcsuss commented 10 years ago

Ahh, this is good to know. What about for directed?

Honestly, Carey frequently asks our group whether we should use largest algebraic or largest magnitude. My answer is that the default should be largest magnitude since statistically it is consistent for a more general class of models. However, frequently the largest algebraic may be a reasonable model constraint for various particular problems. Anyhow, just giving you some more background about why we care.

gaborcsardi commented 10 years ago

Ahh, this is good to know. What about for directed?

The same. For the SVD you calculate the eigenvalue of a symmetric matrix, always.

OK, so largest magnitude will be the new default. Watch out, because this might change the behavior of some of your code.....

dpmcsuss commented 10 years ago

OK, I will let the group know (particularly Youngser) to make sure that everyone knows they should change their code if necessary.

youngser commented 10 years ago

Wait, Why should we change the default option?? I don't remember how many times I use ase (in many different files), and I know may others are also using it.

So, if it's not too much trouble, can we change back to the current default and add a new option??

Thanks!

On May 5, 2014, at 11:05 PM, Daniel Sussman notifications@github.com wrote:

OK, I will let the group know (particularly Youngser) to make sure that everyone knows they should change their code if necessary.

— Reply to this email directly or view it on GitHub.

dpmcsuss commented 10 years ago

Sorry Youngser, I should have asked first. Keeping the default as it was before seems good.

gaborcsardi commented 10 years ago

Btw. aren't the singular values always non-negative anyway? What is the point of having 'largest magnitude' and 'largest algebraic'?

dpmcsuss commented 10 years ago

Well, this issue matters only for directed where the eigenvalues are all real and we have to choose an ordering for them.

For undirected it should always work with singular values which are non-negative as you mentioned.

gaborcsardi commented 10 years ago

AFAIK these are singular values and not eigenvalues. At least they surely are in the code. Singular values are always non-negative.

dpmcsuss commented 10 years ago

Sorry for the confusion. I noticed I said:

Well, this issue matters only for directed where the eigenvalues are all real and we have to choose an ordering for them.

For undirected it should always work with singular values which are non-negative as you mentioned.

I mixed up directed and undirected. For undirected we want the eigenvalues, where ordering options would matter. For directed we want the singular values where ordering options wouldn't matter.

gaborcsardi commented 10 years ago

This function currently does not calculate eigenvalues, it only calculates singular values. You want to add eigenvalues calculation as well?

dpmcsuss commented 10 years ago

Well, that is where the difference comes up. Sometimes largest algebraic is an option we care about for undirected. The eigendecomposition should only be used for the undirected case.

gaborcsardi commented 10 years ago

Just to clarify. Currently the SVD is used for both undirected and directed graphs, and you want to use eigenvalues and eigenvectors for undirected graphs, and keep the current behavior for directed graphs. Right?

dpmcsuss commented 10 years ago

Yes!

Though, really the eigenstuff really only makes a difference for Undirected and Largest Algebraic ordering

Otherwise, the behavior shouldn't change.