Closed concatenize closed 4 years ago
The augmented affinity matrix itself is deterministic and therefore should not change with different runs. The force directed layouts however do have a random initialization and can change from run to run. This can be fixed by setting the random seed.
OK, I will look into this further and see if I can get a minimal example of the problem. What seed should I set? np.random.seed()
from numpy
or random.seed()
from random
or something else?
random.seed
should work.
OK, I just tried it out on a 500x500 example. I find that random.seed(0)
does not work, but np.random.seed(0)
does work, at least for this example. I am attaching example data, code, and environment details. I am using python 3.6.8
.
Can you check and see if you get the same result? Thanks for your help!
Sorry, there is a misplaced line in my example that explains the discrepancy: in fact, the working code block is seeded with random
, not numpy
. This fits better with my past experience as well, because I was sure I had tried the numpy
seed and it failed (as it should have).
This should completely resolve my issue. Thanks again!
Thanks for verifying!
Would you please take a look at this example? I have set the seeds but the result comes out different each time. Maybe I am just missing something simple.
Hello
Thanks for sending the example. I was able to reproduce the layouts by setting np.random.seed
. Please see the attached notebook and let me know if still continue to have issues.
Yes, that works for me too. Thank you!
Eric
I have run Harmony several times with the same input and gotten different results. Is Harmony expected to be deterministic? If so, I can try to work up a minimal example of what I am seeing. If not, then that's fine; I just want to know what to expect. Thanks!