Git Product home page Git Product logo

Comments (6)

yixuan avatar yixuan commented on June 15, 2024

As you have pointed out, RSpectra uses a deterministic initial vector, so it does not use the RNG in R. I may add the support for user-supplied initial vector in a future release.

from rspectra.

flying-sheep avatar flying-sheep commented on June 15, 2024

Oh, of course! I was so distracted by the presence of a RNG that I didn’t think about how you used it.

So we have two reasonable choices:

  1. make the default vector dependent on R’s seed (which means that determinism after set.seed(s) breaks once when that behavior is implemented, and determinism without set.seed(s) is removed)
  2. leave the default vector as that one deterministic one and only add the ability to specify a custom one.

Option 1 is like everyone does it: nondeterminism by default, determinism after set.seed(). Useful to catch artifacts caused by the deterministic vector happening to have some special properties in some use cases

Option 2 is to make things predictable by default.

I’m a fan of option 1. The last thing you want is paper containing wrong findings because your eigenvectors have artifacts in them. I always develop without set.seed() and publish my end results with a seed that makes them 100% reproducible.

from rspectra.

yixuan avatar yixuan commented on June 15, 2024

I may finally choose option 2, since I believe for most users they don't understand or care about the effect of the initial vector. Strictly speaking, the Lanczos method that RSpectra uses is not a randomized algorithm. Virtually the only thing that is random is the initial vector, and it plays a similar role as the initial value in a Newton iteration. As long as it is not too weird, the final result should only have very tiny dependence on it.

If the default one is really bad, the algorithm is very likely to fail somewhere else so users can catch that. Otherwise users may get confused if they are unaware of the Krylov space algorithm.

For advanced users like you, it is trivial to mimic the behaviour of option 1 by passing an runif(n) vector to the function. Does it sound good to you? I'll report here after I add the functionality.

from rspectra.

flying-sheep avatar flying-sheep commented on June 15, 2024

Sounds good, yes! Thank you.

from rspectra.

yixuan avatar yixuan commented on June 15, 2024

Added this feature in the new release. You can now use eigs(..., opts = list(initvec = ...)).

from rspectra.

flying-sheep avatar flying-sheep commented on June 15, 2024

amazing, thank you very much!

from rspectra.

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.