lucastheis / cmt

Fast CPU implementations of several conditional probabilistic models
http://lucastheis.github.io/cmt/
MIT License
36 stars 14 forks source link

initialization of the STM #32

Closed Visdoom closed 3 years ago

Visdoom commented 6 years ago

Hi there Lucas,

I was wondering if you could give a documentation about how to initialize the STM model without knowing the number of linear and non linear components in your input.

from cmt.transforms import WhiteningPreconditioner

# preprocessing
wt = WhiteningPreconditioner(input, output)

stm = STM(dim_in_nonlinear=input.shape[0])
stm.initialize(*wt(input, output))

always results in the error

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-121-b9e4ce8a4de7> in <module>()
      1 stm= STM(dim_in_linear= input.shape[0], dim_in_nonlinear=50,)
----> 2 stm.initialize(*wt(input, output))

RuntimeError: Data has wrong dimensionality.

because the output.rows() != dimOut() condition is triggered in

    if(input.rows() != dimIn() || output.rows() != dimOut())
        throw Exception("Data has wrong dimensionality.");
         ...

However, I cannot control for the output dimension. So how to circumvent that problem?

lucastheis commented 6 years ago

Hi Sophie,

The STM models a single neuron whose spikes/spike counts should be stored in the 1xN matrix output.

What are the multiple rows of your output representing?

Visdoom commented 5 years ago

Hey Lucas,

I actually came back to it. The multiple rows in output are multiple trials.