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

New unit-test SP Test ExactOutput #164

Closed
wants to merge 5 commits into from
Closed

New unit-test SP Test ExactOutput #164

wants to merge 5 commits into from

Conversation

breznak
Copy link
Member

@breznak breznak commented Dec 17, 2018

No description provided.

@breznak
Copy link
Member Author

breznak commented Dec 17, 2018

[ RUN ] SpatialPoolerTest.ExactOutput
/home/mmm/devel/HTM/htm-community/nupic.cpp/src/test/unit/algorithms/SpatialPoolerTest.cpp:1965: Failure
Expected equality of these values:
output
Which is: "SDR( 200 ) 40, 65, 89, 93, 123, 146, 177, 192, 195, 196"
gold
Which is: "SDR( 200 ) 93, 31, 40, 68, 169, 164, 87, 132, 34, 120"
[ FAILED ] SpatialPoolerTest.ExactOutput (296 ms)

this is result of this test backported to previous master (SP w/o Connections)...which is a good thing -> the mistake is in the test, not in SP

@ctrl-z-9000-times
Copy link
Collaborator

This PR requires that the SP is deterministic.

The current "gold" string is wrong. It is supposed to be sorted so that it can be compared as a string. I tried fixing it and it still didn't work, so I will need to take a deeper look at this ...

@breznak
Copy link
Member Author

breznak commented Dec 17, 2018

This PR requires that the SP is deterministic.

This should be truth (even now), given a fixed seed.

I looked briefly at the hinted implementation: I'd think the sorting is not needed. And SDR_t could be (better?) used for the comparison, instead of string&regex ?

@ctrl-z-9000-times
Copy link
Collaborator

I'd think the sorting is not needed. And SDR_t could be (better?) used for the comparison, instead of string&regex ?

The sorting is only needed if it uses string comparison. I think sorting also improves readability of method SDR.print().

I like using strings for the "gold". Its human & machine readable. You can also dump debug & diagnostic info into the gold string, which could be useful. In the extreme case, we could capture standard-out into the gold string and check the full verbose output. If the gold string gets too big then it can move to its own file.

@breznak
Copy link
Member Author

breznak commented Dec 17, 2018

I think sorting also improves readability of method SDR.print().

👍

using strings for the "gold"

Agree in some cases this is useful. Here, we really want to compare SDRs, why not doing it with the specialized type for it? (does not need regex, trimming, can use SDR::==() )

@breznak
Copy link
Member Author

breznak commented Dec 17, 2018

Let's extend the scope of this PR to "Deterministic algorithms (SP, TM)"

  • add such test to TM too (bonus if TP as well)
  • make the algos deterministic given seed
    • I though they should have been?!
    • is random stable across OS, runtime, ... - but we do(?) have tests for that

@ctrl-z-9000-times
Copy link
Collaborator

Moved to PR #197

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

Successfully merging this pull request may close these issues.

2 participants