lfads / lfads-run-manager

Matlab interface for Latent Factor Analysis via Dynamical Systems (LFADS)
https://lfads.github.io/lfads-run-manager
Apache License 2.0
50 stars 29 forks source link

posterior mean rates off by a scale factor #22

Closed pmalonis closed 4 years ago

pmalonis commented 4 years ago

I ran the Lorenz example, and found that the posterior mean rates were off from the true rates by a factor of 1000. This seemed to indicate that the rates were calculated in spikes/ms rather than spikes/s, which isn't a big deal. But then I ran the run manager on the RNN data generated by the code at https://github.com/tensorflow/models/tree/master/research/lfads, and found that the rates were off by a factor of about 33. I'm not sure where this factor comes from. The bin size for this data is 10ms.

Here are the parameters I used in drive_script.m:

par = RNNExample.RunParams; par.name = 'second_attempt'; % name is completely optional and not hashed, for your convenience par.spikeBinMs = 10; par.c_co_dim = 0; % no controller --> no inputs to generator par.c_batch_size = 128; % must be < 1/5 of the min trial count for trainToTestRatio == 4 par.c_factors_dim = 20; % and manually set it for multisession stitched models par.c_gen_dim = 200; % number of units in generator RNN par.c_ic_enc_dim = 128; % number of units in encoder RNN par.c_learning_rate_stop = 1e-5; % we can stop training early for the demo par.c_learning_rate_init = 0.01; par.c_factors_dim = 20; par.c_ext_input_dim = 0; par.c_gen_dim = 200; par.c_ic_dim = 64; par.c_controller_input_lag=1; par.c_output_dist = 'poisson'; par.c_do_causal_controller = false; par.c_keep_prob = 0.95; par.c_controller_input_lag = 1;

pmalonis commented 4 years ago

Sorry the factor for the RNN data is actually between 40 and 45 for the trials I've looked at.

pmalonis commented 4 years ago

I just noticed that the posterior mean struct contains a field scaleFactorCountsToRates, which corresponds to the reciprocal of the bin size in seconds. In this case that's 100. It seems the difference in scale factor to that that is observed is due to LFADS reconstruction error.