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

loadPosteriorMeans expects `rates` field in HDF5-formatted results #11

Closed charlesbmi closed 5 years ago

charlesbmi commented 5 years ago

The example in https://lfads.github.io/lfads-run-manager/ loads data from the HDF5-formatted results and plots the rates field.

As far as I can tell, there is no rates field written to by run_lfads.py in the Python + TensorFlow repo.

Example:

>>> h = h5py.File('/tmp/lfads_chaotic_rnn_no_inputs/model_runs_dataset_N50_S50_valid_posterior_sample_and_average', 'r')
>>> print h.keys()
[u'costs', u'factors', u'gen_ics', u'gen_states', u'nll_bound_iwaes', u'nll_bound_vaes', u'output_dist_params', u'post_g0_logvar', u'post_g0_mean', u'prior_g0_logvar', u'prior_g0_mean', u'train_steps']
djoshea commented 5 years ago

Thanks for highlighting this. What's going on here is that there's a translation between the raw fields that "lfads tensorflow" produces (meaning the Python Tensorflow code in lfads.py), and the names given to these values that the Matlab interface uses in the LFADS.PosteriorMeans class. The name change is intended to align the language used in the manuscript with the code, whereas the Python code uses language more standard in the machine learning community. The documentation is targeted at users using the Matlab LFADS run manager interface and uses the translated field names.

However, the short answer is the rates field you're looking for is called output_dist_params in the raw lfads output. I'm guessing this addresses your issue if you're just trying to work with the output via h5py directly. If not, the Matlab code in loadPosteriorMeans should do this translation automatically though; is it failing for you from Matlab?

charlesbmi commented 5 years ago

Gotcha, thanks!! Haven't tried it in MATLAB fully yet, was just working through an example in Python and tried to match my post-processing to the code in the MATLAB wrapper