# SDR representation

**URL:** <https://discourse.numenta.org/t/sdr-representation/2996>\
**Category:** NuPIC\
**Tags:** sdrs\
**Created:** [October 30, 2017, 12:04pm UTC](https://discourse.numenta.org/t/sdr-representation/2996 "2017-10-30T12:04:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 30, 2017, 12:04pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/1 "2017-10-30T12:04:42Z")

</div>

Hi,  
I want to understand, how to pass from SDR representation (as array of 0/1) to “Matrix” view representation, I cannot see the relation between the Int Array (0…1) and the matrix representation (32x32 columns for exemple).

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 30, 2017, 12:48pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/2 "2017-10-30T12:48:22Z")

</div>

is it something like N columns (with K ones) and M neurons per column (All ones if Burst, 0–1--0 if Contextual) ???

---

<div class="post-metadata">

**Author:** ![cogmission](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/cogmission/32/11_2.png) [@cogmission](https://discourse.numenta.org/u/cogmission)\
**Post date:** [October 30, 2017, 1:18pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/3 "2017-10-30T13:18:48Z")

</div>

Hi @zahir_hamroune,

Sparse arrays are marked by their “positions”. So a “dense” array of:

`1,0,0,1`

in “sparse” syntax would be:

`0,3`

…indicating the “on” positions only…

In order to convert from sparse to dense, you have to know the matrix dimensions, and then fill in all the un-specified positions with “zeros”…

Hope that helps?

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 30, 2017, 1:31pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/4 "2017-10-30T13:31:24Z")

</div>

@cogmission I’m not sure that `0,3` corresponds to the position of matrix position (i,j)  
I think the sparse input `1,0,0,1` could be encoded to this matrix: (one of `C(n,k)=k!/(n-k)!n!` )

`M(cells by col) X N (# cols)`  
`0,0,0,1`  
`0,0,0,0`  
`1,0,0,0`

??

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 9:50am UTC](https://discourse.numenta.org/t/sdr-representation/2996/5 "2017-10-31T09:50:57Z")

</div>

is it right my understanding?

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [October 31, 2017, 3:21pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/6 "2017-10-31T15:21:45Z")

</div>

Are you talking about a specific matrix implementation in NuPIC? Or does this question have something to do with topology?

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 3:23pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/7 "2017-10-31T15:23:46Z")

</div>

Right, my question is about the implementation in NuPIC

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [October 31, 2017, 3:29pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/8 "2017-10-31T15:29:09Z")

</div>

Can you point specifically to the code under question?

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 4:24pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/9 "2017-10-31T16:24:58Z")

</div>

I cannot see any matrix representation of SDR, in

> Blockquote  
> [https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/SpatialPooler.cpp#L491](https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/SpatialPooler.cpp#L491)

it manipulates Vector only so I’m bit confusd with the Matrix Representation topology

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [October 31, 2017, 4:25pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/10 "2017-10-31T16:25:52Z")

</div>

> [@zahir\_hamroune](#):
>
> Matrix Representation

But you brought up the matrix, didn’t you? Where did you see someone talking about matrices then? I don’t mean to be too direct, I just don’t understand what you are asking.

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 4:39pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/11 "2017-10-31T16:39:21Z")

</div>

Ok imagine we have a category **“A”** wich is **1** 00 **11** 0 is it the SDR ?. is it right that we have 6 Cells (3 cells active + 3 non active) ?  
then imagine we receive later **“B”** with SDR representation 0 **1** 00 **11**  
in my understanding for A we will have a “matrix” with N=6 Columns (only K=3 active) and then each Column we will arrange M=2 cells corresponding to the different context for example for “A” we can choose eaither

> Context 1 of “A”= **1** 00 **11** 0  
> 000110  
> 100000  
> or  
> Context 2 of “A”= **1** 00 **11** 0  
> 000100  
> 100010

and for “B”

> Context 1 of “B”=0 **1** 00 **11** may be  
> 010010  
> 000001  
> or  
> Context 2 of “B”=0 **1** 00 **11** may be  
> 010001  
> 010010

according to [http://www.mitpressjournals.org/doi/pdf/10.1162/NECO\_a\_00893](http://www.mitpressjournals.org/doi/pdf/10.1162/NECO_a_00893) page 2480  
each layer is Matrix (NxM cells) ?

---

<div class="post-metadata">

**Author:** ![Paul\_Lamb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/paul_lamb/32/2725_2.png) [@Paul\_Lamb](https://discourse.numenta.org/u/Paul_Lamb)\
**Post date:** [October 31, 2017, 4:51pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/12 "2017-10-31T16:51:54Z")

</div>

The Spatial Pooler algorithm is responsible for selecting active columns only (it is the Temporal Memory algorithm which selects which cells in the columns to become active). So in your example, the SP representation of “A” would be (0,3,4) and would not indicate the context. “B” would be (1,4,5).

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [October 31, 2017, 4:54pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/13 "2017-10-31T16:54:18Z")

</div>

I don’t think it is useful to apply the “matrix” concept here to minicolumns. When you say “Columns” I don’t know if you are talking about columns in the matrix, or minicolumns. I would rather just treat these things as arrays unless there is an explicit topology to the input space.

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 4:55pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/14 "2017-10-31T16:55:37Z")

</div>

Ok I described the TM functional, and Yes Columns in my mind is Mini-Columns that encapsulate “contextual” cells

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 4:57pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/15 "2017-10-31T16:57:09Z")

</div>

At the Columns level ==\> SP responsability  
Mini-cols (context) ==\> TM Responsability  
right?

---

<div class="post-metadata">

**Author:** ![Paul\_Lamb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/paul_lamb/32/2725_2.png) [@Paul\_Lamb](https://discourse.numenta.org/u/Paul_Lamb)\
**Post date:** [October 31, 2017, 4:58pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/16 "2017-10-31T16:58:51Z")

</div>

> [@zahir\_hamroune](#):
>
> At the Columns level ==\> SP responsability  
> Mini-cols (context) ==\> TM Responsability  
> right?

Not quite.

Mini-columns (sometimes just called “columns”) ==\> SP responsibility  
Cells (context) ==\> TM responsibility

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [October 31, 2017, 4:58pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/17 "2017-10-31T16:58:59Z")

</div>

> [@zahir\_hamroune](#):
>
> At the Columns level ==\> SP responsability

What do you mean “columns” here? The SP translates a set of active cells in an input space into a set of active “minicolumns”.

The TM activates cells within those minicolumns.

---

<div class="post-metadata">

**Author:** ![zahir\_hamroune](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/zahir_hamroune/32/5139_2.png) [@zahir\_hamroune](https://discourse.numenta.org/u/zahir_hamroune)\
**Post date:** [October 31, 2017, 5:07pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/18 "2017-10-31T17:07:59Z")

</div>

Ok I think it is clear if I resume if A=1001, then the space size is N=4, then SP will activate (0,3), so there is K=2 active mini-columns of N=4 mini-columns,  
then within 0 and 3 the activated mini-columns , TM will activate a set of Cells (if M cells=Bursting, if 1 cell = selected)

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [October 31, 2017, 5:11pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/19 "2017-10-31T17:11:06Z")

</div>

> [@zahir\_hamroune](#):
>
> Ok I think it is clear if I resume if A=1001, then the space size is N=4, then SP will activate (0,3)

I think you have a major misunderstanding here. The SP will convert this input activation to a completely different activation dependent upon it’s initialization parameters. I think you should review the [material about the spatial pooling algorithm](https://numenta.com/spatial-pooling-algorithm/).

---

<div class="post-metadata">

**Author:** ![Paul\_Lamb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/paul_lamb/32/2725_2.png) [@Paul\_Lamb](https://discourse.numenta.org/u/Paul_Lamb)\
**Post date:** [October 31, 2017, 5:23pm UTC](https://discourse.numenta.org/t/sdr-representation/2996/20 "2017-10-31T17:23:12Z")

</div>

> [@rhyolight](#):
>
> The SP will convert this input activation to a completely different activation dependent upon it’s initialization parameters

Good point. I assumed in my above responses that “1001” represents the active minicolumns after SP, not the active cells in the input space.
