Decoder¶
- class compressed_kde.compressed_kde.decode.Decoder¶
Bases:
pybind11_objectDecoder class.
Construction of a Decoder requires one or more sets of PoissonLikelihood objects and optional priors. There are two ways to construct a Decoder, depending on whether you would like to decode over multiple stimulus spaces or not.
- Decoder(likelihoods, prior)¶
- Decoder(likelihoods, priors)
In the first syntax, one passes a list of likelihood objects that all share the same stimulus space and (optionally) an array with prior probabilities for the grid points in the stimulus space.
In the second syntax, one passes a nested list of likelihoods, where the outer list represents the data sources (e.g. individual tetrodes) and the inner lists represent multiple stimulus spaces one would like to decode over. The (optional) prior probabilities for each stimulus space are provided as a list of arrays.
- Parameters
Attributes Summary
Enabled state for all sources.
Grid shape for each stimulus space.
Grid size for each stimulus space.
Whether decoding is performed over union of stimulus spaces.
Number of stimulus spaces over which decoding is performed.
Number of sources that are used for decoding.
Number of sources (likelihoods).
Methods Summary
decode(events, delta, normalize)Compute posterior probability distribution.
decode_single(events, delta, index, normalize)Compute posterior probability distribution for single stimulus space.
disable_source(source)Disable source.
Enable all sources.
enable_one_source(source)Enable single source and disable all others.
enable_source(source)Enable source.
enable_sources(state)Set enable state of sources.
grid(index)Get stimulus space grid.
grid_shape(index)Grid size.
grid_size(index)Grid size.
likelihood(source, index)Get likelihood.
load_from_hdf5(path)Load decoder from hdf5 file.
save_to_hdf5(filename, flags, path)Save decoder to hdf5 file.
stimulus(index)Get stimulus space.
Attributes Documentation
- enabled_sources¶
Enabled state for all sources.
- grid_shapes¶
Grid shape for each stimulus space.
- grid_sizes¶
Grid size for each stimulus space.
- is_union¶
Whether decoding is performed over union of stimulus spaces.
- n_union¶
Number of stimulus spaces over which decoding is performed.
- nenabled_sources¶
Number of sources that are used for decoding.
- nsources¶
Number of sources (likelihoods).
Methods Documentation
- decode(events, delta, normalize) [array]¶
Compute posterior probability distribution.
- Parameters
- Return type
list with posterior distribution for each of the union-ed stimulus spaces.
- decode_single(events, delta, index, normalize) array¶
Compute posterior probability distribution for single stimulus space.
- Parameters
events (list of (n,ndim) arrays) – A list with for each source the observed event data.
delta (float) – Time duration over which events were observed.
index (int) – Index of stimulus space in union that is target of decoding.
normalize (bool) – Normalize posterior distribution such that is sums to one.
- Return type
posterior distribution for selected stimulus space.
- disable_source(source) None¶
Disable source.
- Parameters
source (int) – Index of source (zero-based).
- enable_all_sources()¶
Enable all sources.
- enable_one_source(source) None¶
Enable single source and disable all others.
- Parameters
source (int) – Index of source (zero-based).
- enable_sources(state) None¶
Set enable state of sources.
- Parameters
state (list or 1d array) – For each source the enabled state (True/False).
- grid_shape(index) [int]¶
Grid size.
- Parameters
index (int) – Index of stimulus space in union (zero-based).
- Return type
grid shape
- grid_size(index) int¶
Grid size.
- Parameters
index (int) – Index of stimulus space in union (zero-based).
- Returns
int
- Return type
grid size
- likelihood(source, index) PoissonLikelihood¶
Get likelihood.
- Parameters
- Return type
- static load_from_hdf5(path) Decoder¶
Load decoder from hdf5 file.
- Parameters
path (string) – path to hdf5 file
- Return type