Giter Club home page Giter Club logo

Comments (7)

mdeff avatar mdeff commented on May 18, 2024 2

It's indeed a numerical issue then (your largest eigenvalue is marginally above 2). We'll relax the assertion. In the mean time you can just comment it. Thanks for reporting!

from pygsp.

nperraud avatar nperraud commented on May 18, 2024 1

This assertion is only done if the Laplacian is normalized.

if self.lap_type == 'normalized':
     # Spectrum bounded by [0, 2].
     assert self._e[-1] <= 2

In this case, the spectrum has to be bounded by 2 from the theory. So if your weight matrix is non-negative and symmetric, it should always pass this test.

from pygsp.

lucy3 avatar lucy3 commented on May 18, 2024

Thank you so much for the reply; I really appreciate it.
Hmmm... this is strange, then. The minimum weight in my weight matrix is 1 and G.is_directed() returns False. Any other possible reasons this would fail?

Edit: I tried this:

Gg=pygsp.graphs.Graph(nx.adjacency_matrix(G),lap_type='normalized')
e, U = np.linalg.eigh(Gg.L.toarray())
print e[-1]
Gg.compute_fourier_basis(recompute=True)

This printed 2.0 followed by the assertion error assert self._e[-1] <= 2

Also, I have the following:

print "largest eigenvalue:", Gg._e[-1]
print "Gg._e[-1] == 2.0", Gg._e[-1] == 2.0
print "2.0 <= 2", 2.0 <= 2
print "Gg._e[-1] <= 2", Gg._e[-1] <= 2
print "float(Gg._e[-1]) == 2.0", float(Gg._e[-1]) == 2.0
print "float(Gg._e[-1])", float(Gg._e[-1])

The print output of the above is:
largest eigenvalue: 2.0
Gg._e[-1] == 2.0 False
2.0 <= 2 True
Gg._e[-1] <= 2 False
float(Gg._e[-1]) == 2.0 False
float(Gg._e[-1]) 2.0

I'm pretty confused now. It seems like when I print Gg._e[-1], its value is 2.0, yet the comparisons aren't working.

from pygsp.

nperraud avatar nperraud commented on May 18, 2024

It really looks like a numerical error. We should relax slightly the assertion. I will do it this afternoon.
Thanks for reporting this bug.

from pygsp.

nperraud avatar nperraud commented on May 18, 2024

Could you print for us self._e[-1]-2?

from pygsp.

lucy3 avatar lucy3 commented on May 18, 2024

It prints out 4.84057238737e-14.

from pygsp.

mdeff avatar mdeff commented on May 18, 2024

That was fixed in 58421d5.

from pygsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.