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

TM, SP: fix possible underflow in seed. Default random (0) seed. #799

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

breznak
Copy link
Member

@breznak breznak commented Apr 22, 2020

  • fixed type for possible integer underflow in SP
  • default seed is "random" (0). Also in Python.
  • use directly fixed seed where needed in tests for deterministic
    results. (for this added c++ helper methods setSeed(UInt) )
  • fix docs
  • update tests

To be used by NAB detector.

For use in #792 ,

- fixed type for possible integer underflow in SP
- default seed is "random" (0). Also in Python.
- use directly fixed seed where needed in tests for deterministic
results. (for this added c++ helper methods `setSeed(UInt)` )
- fix docs
- update tests

To be used by NAB detector.
@breznak breznak added the code code enhancement, optimization, cleanup..programmer stuff label Apr 22, 2020
@breznak breznak requested a review from dkeeney April 22, 2020 17:52
Copy link
Member Author

@breznak breznak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkeeney could you have a look with me please?
Most changes ironed out, but there's something stinky in the SP's seed, serialization. I recall a user reporting a bug here with different results with a SP loaded from serialized state.

@@ -94,6 +93,12 @@ EPOCHS = 2; // make test faster in Debug
Metrics statsSPglobal(outSPglobal, 1000);
Metrics statsTM(outTM, 1000);

//uses fixed seed for deterministic output checks:
Random rnd(42);
spGlobal.setSeed(1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a strange thing is happening here, I set the rng_ to fixed seed (1 used to be used before) ...but determ. output is still changing!

@@ -173,9 +173,9 @@ Argument boostStrength A number greater or equal than 0, used to
too much boosting may also lead to instability of SP outputs.


Argument seed Seed for our random number generator. If seed is < 0
Argument seed Seed for our random number generator. If seed is 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected the doc strings

@@ -197,7 +197,7 @@ Argument wrapAround boolean value that determines whether or not inputs
, py::arg("minPctOverlapDutyCycle") = 0.001
, py::arg("dutyCyclePeriod") = 1000
, py::arg("boostStrength") = 0.0
, py::arg("seed") = 1
, py::arg("seed") = 0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the defaults to "random" (0) in cpp, py, NetworkAPI


testTimer.stop();

EXPECT_EQ(outputBaseline, outputC);
EXPECT_EQ(outputBaseline, outputC); //FIXME this test randomly fails. (De/serialization of rng_ is correct?)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is another test that is inconsistent! Sometimes it passes, sometimes crashes on different outputs. I can't see why would that be, the test is relatively simple and seems correct.
I'm suspecting something with serizalization of Random?
Even more confusing is why HellpSPTP fails undeterministically now?

dkeeney
dkeeney previously approved these changes Apr 22, 2020
Copy link

@dkeeney dkeeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a quick look at the Random code and it looks ok. Nothing obvious that might cause it to fail.

I need more precise detail if/why two SPs differ.
these are helper data classes that hold "heavy" info on connections:
SegmentData, SynapseData
to be more descriptive when difference is found.
Useful for debugging.
apparently improper combination of cereal::make_nvp()
and CEERAL_NVP(). Only the latter should be used.

Finished simplified Conn serialization, only data-members are directly
serialized. No need to call initialize() and other functions manually.
@breznak
Copy link
Member Author

breznak commented Jun 3, 2020

Waiting for bigger changes in #601 , after that I should debug this.

@breznak breznak self-assigned this Jun 3, 2020
dkeeney
dkeeney previously approved these changes Jun 4, 2020
Copy link

@dkeeney dkeeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code code enhancement, optimization, cleanup..programmer stuff serializable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants