nupic.core-legacy
nupic.core-legacy copied to clipboard
SP. compute() is much slower for 1D input/SP rather than multi-dimensional
FYI when I construct
- a multi-dimensional
SP(columnDimensions=[2048, 1, 1])
I get speed0.018sec/1call
- 1D SP
SP(columnDimensions=[2048])
the speed is0.1sec/1call
...10x slower!
...that is with globalInhibition=False
, didnt test with true.
@scottpurdy what do you think?
That is surprising. I knew that the single-dimension case was handled differently but I thought it was supposed to be slightly faster! If it is really slower than we should just use the n-dimensional implementation for all cases.
That is surprising
The issue is 1 yr old, I'll verify on the benchmark and if confirmed I'll follow up with your suggestion.
Watching this
Please review this issue
This issue needs to be reviewed by the original author or another contributor for applicability to the current codebase. The issue might be obsolete or need updating to match current standards and practices. If the issue is out of date, please close. Otherwise please leave a comment to justify its continuing existence. It may be closed in the future if no further activity is noted.
Confirmed; pushed PR with test code + results to Nupic. both pure-py and py+cpp code is approx 2x faster with 2D,rather than 1D (one would expect similar speed, or 1D faster)
TODO:
- [ ] needs re-validation on pure C++ code, it could be problem of py-c++ wrappers.
- [ ] either fix, or default to "1D" as
(dim,1)
(fake 2D)
The C++ version can be profiled e.g on the "Anomaly example" PR, I recall there is a 1D and nD version of the methods (near. neighbours) - would be nice if we could drop the 1D for both cleanup and speedup.
@mrcslws Was wondering if you'd take a look at this and add your input.