Conversation
By analyzing the blame information on this pull request, we identified @scottpurdy, @oxtopus and @rcrowder to be potential reviewers |
|
||
#include "nupic/encoders/ScalarEncoder.hpp" | ||
#include "nupic/algorithms/SpatialPooler.hpp" | ||
#include "nupic/algorithms/Cells4.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's work with TemporalMemory
instead, as the API is cleaner and closer to the reference python impl.
(I'd still be curious how to get the proper data from TP implementation)
ping @numenta/nupic-committers ;) I'd like some review before the work continues. |
@scottpurdy can I get a review on this please? |
519356e
to
c1daf53
Compare
static std::vector<UInt> cellsToColumns(const std::vector<UInt>& cellsBinary, const UInt cellsPerColumn); | ||
}; | ||
|
||
#include "nupic/utils/VectorHelpers.cpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scottpurdy @oxtopus @chetan51 guys, I need help on the templates, it's a damn headache in C++ :/
It would be nice and useful; but templates don't "allow" separation of implementation to cpp/hpp & our project seems to require inclusion only of cpp files, because with the hpp I'm getting redeclaration
errors as the VectorHelpers.hpp
is included on more places (even though I'm using #ifndef gates for includes) in libnupic_core_solo.a etc.
It's a static class, can I make it a header only and make it work somehow with the build system?
I'm stuck here, thanks for any advice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Templates are evaluated at compile-time so any templated types/functions have to be in the headers. Do not include cpp
files anywhere.
Please break out the components into separate PRs. |
is that necessary? the commits are standalone, but all the functionality is just for this example. |
Yes, I think there is a lot of work to do here before these things can be merged (there are issues with code conventions, API design, and basic C++ organization) and I don't want to have conversations for all the different components in the same PR since it would be unmanageable. Better to start with one small component like the CSV reader/writer, get that merged, then move to the next piece. |
@scottpurdy separated to multiple PRs as requested, please review all of them when you can. |
@breznak @scottpurdy Would this be a possible tool to use to learn C++? |
Would this be a possible tool to use to learn C++?
I like to take examples as such...not only an example of what the
nupic.core can do, but a demo how to do it, so others can rework it for
their usage.
|
I'm suprised noone thought of this solution when I asked for help in the PR :/
as another (TP/TM/ETM) TM implementation that can be tested
rounding, drop trailing 0s, void <0 score mistakes,..
as it avoids unnecessary conversions + is faster than the dense/binary version
@rhyolight I've revisited this long-dead PR; fixed the problems, hope to resolve the coding style issues (if there's a cpp-lint profile, please tell me how to use it, else please point out remaining issues), optimized the code a bit and extended the example to use all 3 temporal memory implementations (TP/TM/ETM). |
Time for another code review round @scottpurdy / @mrcslws |
@breznak - Great to see this come back up. I'd like to see a little different implementation, similar to how we've changed things in nupic. The class that you are adding here has three separate TM implementations even though only one of them is used. Here's my proposal for how to get this same functionality and allow external experimentation with different anomaly detection algorithms and different TM implementations:
One thing I see you adding here that you've done elsewhere as well is try to make a class handle multiple implementations. The problem with this is that the implementations have different interfaces (different constructor params, different methods, etc). A better way to do this is to define the common interface. Then you have separate wrapper classes that implement the interface and translate from the common interface to the specific implementations constructors and methods. Once you've done this, you can create a factory function that takes the common interface parameters and generically creates one of the wrapper instances. The interface may be specific to your application though, in which case we wouldn't put it in NuPIC. |
Hi @scottpurdy , thank you for the quick response!
|
Yeah no problem if you don't want to use the network api but all of the logic still applies. Is your goal here to provide an anomaly detection example in nupic.core or to expose some functionality for work that you want to do? If it is the former then we should just get a standard AD setup. No need for supporting multiple TM implementations. If it is the latter, then you should already be able to use these algorithms (or any of your own) however you'd like. The interface setup is just a suggestion since I think it creates cleaner code then "monolithic" classes that contain multiple algorithms. |
My motivation is both an AD example + I use/need the code with different TM implementations for evaluation experiments.
I'd prefer the variant where the option to switch TM implementations is kept, as it allows for nice and easy experimentation, but I dont care too much.. |
It would be a great to get an AD example into nupic.core (with and without the network api). There are some things I'd like to do first, like numenta/nupic-legacy#3228. And we need to get the taxi dataset into core (I don't think it has been added to nupic either). But then we should be able to create a simple AD example with and without the network api. |
@scottpurdy are those necessarily related to the PR? Are there any obstacles to merging as-is (the code is functional) and doing any modifications as follow-ups? |
@breznak Marek, you've obviously put a lot of work into this, and I know this is not what you want to hear, but after discussing this internally I'm going to close this PR. The reasons are:
That being said, I hate to see this example going to waste. I would like to see you put it in https://github.com/htm-community/nupic-example-code repository. You have push rights to this repo, and we can start collecting NuPIC use-cases here created by the community and without a strict code review process. |
calls the Encoder, SpatialPooler, TemporalPooler and Anomaly classes to show
a full chain C++ demo.
Adds some helper utils for working with CSV and vectors.
Fixes: #889
Blocked by:
#869#904#902TODO:
Anomaly
merged (blocked)VectorHelpers
(?)CSVHelpers
testsTimer
from HelloSP_TPremoveHello_SP_TP
initialize() and compute()
methods