Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SP Cleanup: Use only sp.avgConnectedSpanForColumnND #119

Merged
merged 3 commits into from
Nov 27, 2018
Merged

SP Cleanup: Use only sp.avgConnectedSpanForColumnND #119

merged 3 commits into from
Nov 27, 2018

Conversation

ctrl-z-9000-times
Copy link
Collaborator

Removed code for 1D & 2D coordinate conversion and avgConnectedSpan. Use the more general purpose N-dimsensional code instead.

Copy link
Member

@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.

The 1D/2D were supposted to be optimizations originally. Please verify the speed with 1D, you can use ConnectionsPerformanceTest.*SP() - and adapt the code to use 1D variant. Confirm the speed of nD is not much worse than 1D

src/nupic/algorithms/SpatialPooler.cpp Show resolved Hide resolved
return (rowSpan + colSpan) / 2.0f;
}


Real SpatialPooler::avgConnectedSpanForColumnND_(UInt column) const {
Copy link
Member

Choose a reason for hiding this comment

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

it's interesting that the current SP does not use the 1D/2D, but only nD already?!

Copy link
Member

@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.

I'm evaluation the performance impact of ND vs 1D, where algorithmically the 1D is really simpler.

  • Global Inh
[ RUN      ] HelloSPTPTest.performance
starting test. DIM_INPUT=10000, DIM=2048, CELLS=10
EPOCHS = 1000
starting:  1000 iterations.Total elapsed time = 0 seconds
[       OK ] HelloSPTPTest.performance (1027 ms)
[----------] 1 test from HelloSPTPTest (1027 ms total)
  • Local, 1D (to be removed):
[ RUN      ] HelloSPTPTest.performance
starting test. DIM_INPUT=10000, DIM=2048, CELLS=10
EPOCHS = 1000
starting:  1000 iterations.Total elapsed time = 74 seconds
/home/mmm/devel/HTM/htm-community/nupic.cpp/src/test/unit/algorithms/HelloSPTPTest.cpp:101: Failure
Value of: timeTotal <= CI_avg_time
  Actual: false
Expected: true
HelloSPTP test slower than expected! (74,should be 45
[  FAILED  ] HelloSPTPTest.performance (74195 ms)
[----------] 1 test from HelloSPTPTest (74195 ms total)
  • local, ND (proposed default, resp. only choice):
[ RUN      ] HelloSPTPTest.performance
starting test. DIM_INPUT=10000, DIM=2048, CELLS=10
EPOCHS = 1000
starting:  1000 iterations.Total elapsed time = 75 seconds
/home/mmm/devel/HTM/htm-community/nupic.cpp/src/test/unit/algorithms/HelloSPTPTest.cpp:101: Failure
Value of: timeTotal <= CI_avg_time
  Actual: false
Expected: true
HelloSPTP test slower than expected! (75,should be 45
[  FAILED  ] HelloSPTPTest.performance (75335 ms)
[----------] 1 test from HelloSPTPTest (75335 ms total)

TL;DR

  • local inhibition is very slow! 70x (1s vs 74s global/local inhibition)
  • this PR (1D/ND) does not change that (-> 🆗 merge)
  • we should work on improving speed of local inh (Integrate CUDA SP as a C++ wrapper  #50 )
  • there are no unit tests for local inhibition!

@breznak breznak merged commit b502019 into htm-community:master Nov 27, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants