-
Notifications
You must be signed in to change notification settings - Fork 75
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
Classifier: use map to allow sparse categories WIP #680
base: hotgym_predictor
Are you sure you want to change the base?
Conversation
use map internally for categories_, instead of vector, which allows us to have sparse {1,2,999} categories (=3 total). Instead, with vector this would have to be 999 categories!
I'm not against you changing the classifier to use sparse categories. There are pro's and con's for both |
@breznak do you get any better performance after changing to use map? |
I didn't get back to this PR yet, and haven't tested performance extensively. OT: Coincidentely, I'm just running performance benchmarks right now, the master branch is faster since I've last measured (comparison with Martin's GPU version.). And I have prepared another PR that simplifies and makes the TM faster. I'm now tuning PGO (but results seem worse than w/o it (??)) |
Generally linear searching through a std::vector is faster than the O(log n) lookup in a map when you have say < 120 elements. I usually code up a STL compatible Side note: The SDRClassifer in my library is in fact CLAClassifer (which I believe have been deprecated in this repo). I'm hesitate to pull in NN stuff. That is a steep slippery slope. |
speaking in pseudocode, this is an internal switch:
? We might try that for Connections, but I'm not sure I'll go such microoptization (yet).
I'm not sure what CLAClassifier was, but the "NN stuff" means you don't want to use "other than HTM NN stuff"? As the current SDRClassifier is a simple |
Thanks all |
Exactly. I wonder if we will ever need a hash map tho. Even DNNs rarely do > 120 class classification.
Maybe I'm wrong. I thought the SDRClassifer in NuPIC/HTM.core is a simple MLP with softmax activation. I could easily go too far and make Etaler support advanced Deep Learning. (I that a good thing)?
Described here. https://www.youtube.com/watch?v=QZBtaP_gcn0 |
@marty1885 you are right. Currently, SDRClassifier has only one hidden layer + softmax. Maybe by adding more (recurrent) layer we can get better classification quality |
just a single layer + softmax, but right..
adding more (and reccurent only make sense for sequences) should not make any difference if we think HTM works. It is fair to test if (and I hope it should not) it makes things better. But if HTM works correctly, all the (incl. temporal) information is in SDR and well distributed for trivial classification. So from the point of view of the theory improved classifiers should not (need to) exist in the repo. Actually, my plan is to go in the opposite direction and introduce biiological classifier. Works like 1-NN. I plan to test it on MNIST, create "etalons" for each digit (0-9)-> SDR_0-9. Then classification would be nearest neighbor (=max overlap) over the etalons and the tried sample. |
Can you tell more about it? |
should be really simple and builds on the principles of SDR representations. |
@breznak |
let's demonstrate it on a simple example MNIST:
Basically, it assumes all needed info is already in the SDR, and that |
I am 60% sure they are the same algorithm. Again, in a MINIST example.
|
@breznak @marty1885 if I remember well, your algo looks like what htmresearch does for object classification using sensor and location information. By learning, it use union of all SDR representation for the same object. By inference, it calculates the overlap between the current SDR and the learned SDR representation. |
seems the same in principle to me.
d is your raw data, or SDR (
yes, this is the principle. IMHO the only plausible way to do classification with HTM. |
Ahh, I forget that. Yes, d is indeed
I tried binary initially. But it turned out to be a bad idea as noise ended up turning the SDR into a Dense DR. |
interesting, indeed. It would suggest the SP had not learned properly (too small SDR, not enough sparse, ...) or that the concepts (of "1 one" etc) are learned as more entities. Would your code be easily applicable to this codebase, or am I better off writing it from scratch? |
It is easy to code from scratch. You can use my code from HTMHelper. Although I'm using a dense array instead of SDR there.
I suspect it is the problem of MNIST itself. Images does not fulfill the properties of a SDR. ex. 1 and 7 can have many overlapping bits even though they are different numbers. So SP will have a hard time separating them. |
use map internally for categories_, instead of vector, which allows us
to have sparse {1,2,999} categories (=3 total). Instead, with vector
this would have to be 999 categories!
Do not merge, for review comments only. Attempt to switch from using continuous label indices to non-cont. labels in Classifier.