How the SDR Classifier Works

Hi all. I just finished writing up a blog post on the SDR Classifier. Just wanted to share it here.

Excerpt of post:

I was recently involved in the porting of NuPIC’s SDR Classifier to Java, for the HTM.Java project. When I began the process, I knew pretty much nothing about the SDR Classifier or neural networks. So, I took extensive notes while I learned about them. I’ve decided to curate my notes and present them in this blog post, in the hope that they will prove useful.


Andrew (@Hopding) ,

Awesome job! Thank you so much for sharing your learning experience and hard work with us! Your blog made it very easy to follow the inner workings of the SDRClassifier, and I really appreciate the care you took in keeping things very easy to understand! :tada:

1 Like

Thank you very much . Your post is very useful and value for me.

Btw , can you explan more detail the pink components ( bucket index, record number, other Fields, Predicted Fiels) in your figure below

and you also give a very clear example in ( Example Learning Case) . Can you add a more detail example from the beginging step( input space --> encoder )

Thank you very much.

You might enjoy watching this video explanation of the SDR Classifier.

1 Like

Thank you @rhyolight. i will look that video. BTW i would like to ask

In general, amount of bucket is calculated by =n-w+1 ?

But in the RandomDistributedScalarEncoder , the active bits ( 1- bits) is not continuous ( sparkly) but distributed throughout the space. So how can i calculate the amount of bucket and bucket index (the algorithm of getBucketIndices) ?

Thank you very much

Is there anyone help me anwser the question above ? thank you very much

I don’t know, but I would look at the RDSE tests first.

Hi @life_happy,

In general, for the original simple scalar encoder, yes, the bucket calculation is simple like you mention (although I’m not sure on the exact formula).

As for the RDSE, from the source:

Numbers within [offset-resolution/2, offset+resolution/2] will fall into the same bucket and thus have an identical representation. Adjacent buckets will differ in one bit.

resolution and offset are encoder parameters.

The RDSE keeps a map of buckets in memory for lookup (unlike the simple scalar encoder, which can be reverse-engineered). The map is created on encoder init.

The key to the RDSE bucket lookup is this little bit of code on line 210:

 bucketIdx = (
     (self._maxBuckets/2) + int(round((x - self._offset) / self.resolution))

Does that help?

1 Like