nupic.core-legacy icon indicating copy to clipboard operation
nupic.core-legacy copied to clipboard

SP. compute() is much slower for 1D input/SP rather than multi-dimensional

Open breznak opened this issue 9 years ago • 8 comments

FYI when I construct

  • a multi-dimensional SP(columnDimensions=[2048, 1, 1]) I get speed 0.018sec/1call
  • 1D SP SP(columnDimensions=[2048]) the speed is 0.1sec/1call ...10x slower!

...that is with globalInhibition=False , didnt test with true.

breznak avatar Mar 01 '15 15:03 breznak

@scottpurdy what do you think?

breznak avatar Mar 22 '16 23:03 breznak

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.

scottpurdy avatar Mar 22 '16 23:03 scottpurdy

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.

breznak avatar Mar 22 '16 23:03 breznak

Watching this

cogmission avatar Mar 23 '16 01:03 cogmission

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.

rhyolight avatar May 18 '16 03:05 rhyolight

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)

breznak avatar May 18 '16 10:05 breznak

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.

breznak avatar May 18 '16 10:05 breznak

@mrcslws Was wondering if you'd take a look at this and add your input.

rhyolight avatar May 25 '16 15:05 rhyolight