# Calculate Properties of random-uniform SDRs?

hi,

I’m trying to answer several questions about properties of randomly uniform generated SDR with sparsesness of “s”.
Let me know if I’m correct !

First question : given TWO SDRs of lengths “n” bits.

• what is the probability that they don’t overlap at all ?
• what is the probability that they match 100% ?
• what is the probability that they overlap by “q” percent of “s” ?

Here is my thinking : the probability that bit at any position is 1 for both vectors is “s*s” i.e. `s^2`

From this it follows that the probability of full match is :` (s^2)^(s*n)`

Then the probability of partial match of q% is of s%*nbits is : `(s^2)^(q*s*n)`

For example if we have : n=100, s=0.02 , q=0.50
the probability of partial match is :

`````` -> (0.02^2)^(0.5*0.02*100)
= 0.0004
``````

from this it follows that : the probability of no overlap is : 1 - x => 0.9996

m’I correct ?

Next very important question how do I calculate those for “M” SDRs, not just TWO ?

Experimentally I’m getting max 8-9bits overlap when : n=2000, sparsity=0.02 and up 5000 random-samples full comparison i.e. 9/40= max 22.5% overlap

I think I should refer you to the existing literature on the subject. I do believe you will find answers to many of your questions in our SDR Research Papers, this one in particular.

they are not assuming randomly generated SDRs ! I think !

When I made this video I got the exact formulas for my code from those papers. I think what you are looking to define is something I called the “overlap set cardinality” in the video. Search the papers for cardinality.

1 Like

do you have the visualization you use in the videos running somewhere ?

Not running somewhere, but there is How to Run HTM School Visualizations and Building HTM Systems (both open source).

hmm… tried HTM several months ago, but it downgrades numpy and breaks other packages ;(

You don’t need NuPIC or HTM to run the client and see the SDR math visuals.