PoissonLikelihood

class compressed_kde.compressed_kde.decode.PoissonLikelihood

Bases: pybind11_object

Poisson likelihood class.

There are multiple ways to construct this object, depending on whether you have already constructed a Stimulus object and whether events have attributes (e.g. spike amplitude) or not (e.g. when using sorted spikes).

PoissonLikelihood(event_space, stimulus_space, grid, stimulus_duration, compression)
PoissonLikelihood(stimulus_space, grid, stimulus_duration, compression)
PoissonLikelihood(event_space, stimulus)
PoissonLikelihood(stimulus)
Parameters
  • event_space (Space object) – Description of event space.

  • stimulus_space (Space object) – Description of stimulus space.

  • stimulus (Stimulus object) – Stimulus distribution. The stimulus space, grid and compression threshold will be determined by the Stimulus object.

  • grid (Grid object) – Evaluation grid for stimulus space.

  • stimulus_duration (float) – Duration (in seconds) of single stimulus.

  • compression (float) – Compression threshold.

Attributes Summary

changed

True of underlying distributions have changed and updated pre-computation is needed.

event_distribution

Underlying (compressed) density of merged events.

event_rate

Marginal event rate evaluated on grid.

grid

Evaluation grid in stimulus space.

mu

Mean event rate.

ndim

Combined dimensionality of event and stimulus space.

ndim_events

Dimensionality of event space.

ndim_stimulus

Dimensionality of stimulus space.

random_insertion

Randomize new samples before merging into distribution.

rate_scale

Event rate scaling factor that is applied during likelihood evaluation.

stimulus

Stimulus occupancy.

stimulus_logp

Log probability of stimulus distribution evaluated on grid.

Methods Summary

add_events(events, repetitions)

Merge new events into event distribution.

event_logp(events)

Log probability of observing events evaluated on grid.

event_prob(events)

Probability of observing events evaluated on grid.

likelihood(events, delta)

Evaluate likelihood on grid given observed events.

load_from_hdf5(path)

Load poisson likelihood from hdf5 file.

logL(events, delta)

Evaluate log likelihood on grid given observed events.

precompute

Execute and cache intermediate computations.

save_to_hdf5(filename, save_stimulus, flags, ...)

Save stimulus occupancy to hdf5 file.

save_to_yaml(path, save-stimulus)

Save Poisson likelihood to YAML file.

to_yaml(save_stimulus)

Represent stimulus occupancy as YAML.

Attributes Documentation

changed

True of underlying distributions have changed and updated pre-computation is needed.

event_distribution

Underlying (compressed) density of merged events.

event_rate

Marginal event rate evaluated on grid.

grid

Evaluation grid in stimulus space.

mu

Mean event rate.

ndim

Combined dimensionality of event and stimulus space.

ndim_events

Dimensionality of event space.

ndim_stimulus

Dimensionality of stimulus space.

random_insertion

Randomize new samples before merging into distribution.

rate_scale

Event rate scaling factor that is applied during likelihood evaluation.

stimulus

Stimulus occupancy.

stimulus_logp

Log probability of stimulus distribution evaluated on grid.

Methods Documentation

add_events(events, repetitions) None

Merge new events into event distribution.

Parameters
  • events ((n,ndim) array) – Array of event data

  • repetitions (int) – Number of repetitions for events to be merged.

event_logp(events) array

Log probability of observing events evaluated on grid.

Parameters

events ((n,ndim) array) – Array with event data

Return type

nd array

event_prob(events) array

Probability of observing events evaluated on grid.

Parameters

events ((n,ndim) array) – Array with event data

Return type

nd array

likelihood(events, delta) array

Evaluate likelihood on grid given observed events.

Parameters
  • events ((n,ndim) array) – Array with event data.

  • delta (float) – Time duration over which events where observed.

Return type

nd array

static load_from_hdf5(path) PoissonLikelihood

Load poisson likelihood from hdf5 file.

Parameters

path (string) – path to hdf5 file

Return type

PoissonLikelihood

logL(events, delta) array

Evaluate log likelihood on grid given observed events.

Parameters
  • events ((n,ndim) array) – Array with event data.

  • delta (float) – Time duration over which events were observed.

Return type

nd array

precompute()

Execute and cache intermediate computations.

save_to_hdf5(filename, save_stimulus, flags, path) None

Save stimulus occupancy to hdf5 file.

Parameters
  • filename (str) – path to hdf5 file

  • save_stimulus (bool) – Save stimulus occupancy distribution to hdf5 file in addition to event distribution.

  • flags (int) – flags for file creation

  • path (str) – path inside hdf5 file

save_to_yaml(path, save-stimulus) None

Save Poisson likelihood to YAML file.

Parameters
  • path (string) – path tho YAML file

  • save_stimulus (bool) – Save stimulus occupancy distribution to YAML file in addition to event distribution.

to_yaml(save_stimulus) str

Represent stimulus occupancy as YAML.

Parameters

save_stimulus (bool) – Convert stimulus occupancy distribution to YAML in addition to event distribution.

Return type

string