Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power method does not converge #38

Closed
dennlinger opened this issue Feb 16, 2022 · 1 comment
Closed

Power method does not converge #38

dennlinger opened this issue Feb 16, 2022 · 1 comment

Comments

@dennlinger
Copy link

I have the problem that for a given transition matrix, I cannot reach convergence with the implemented _power_method. Instead, after only a few iterations, I am left with only NaN values in the eigenvector guess.

Given that there are existing functions in numpy etc. for computing eigenvectors, is there any particular reason to use the given power method implementation?

@dennlinger
Copy link
Author

I've realized this is a problem of my transition matrix, which has non-normalized transition scores (with potentially negative values) in it. Since this violates the non-periodicity and irreducibility assumption about a Markov chain, it may happen that the iterative power method actually diverges.

The problem can be resolved by adding a custom normalization, for example, with scipy.special.softmax(), in create_markov_matrix().
Since this doesn't regularly happen with the traditional graph degree-based approach, I'll close this issue here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant