BinomialSynapses.jl
Models
BinomialSynapses.AbstractBinomialModel
— TypeAbstractBinomialModel
An abstract type for binomial synaptic models. A binomial model always has the following parameters:
N
: number of release sitesp
: probability of releaseq
: quantum of releaseσ
: observation noiseτ
: refilling time constant
BinomialSynapses.BinomialGridModel
— TypeBinomialGridModel(
Nind, pind, qind, σind, τind,
Nrng, prng, qrng, σrng, τrng,
N, p, q, σ, τ
)
A binomial model ensemble whose parameters are constrained to live on a grid defined by Nrng
, prng
, etc.
BinomialSynapses.BinomialGridModel
— MethodBinomialGridModel(
Nind, pind, qind, σind, τind,
Nrng, prng, qrng, σrng, τrng
)
Construct a binomial model ensemble with parameters on a grid, e.g. Nrng
, based on choosing indices, e.g. Nind
.
BinomialSynapses.BinomialGridModel
— MethodBinomialGridModel(m_out, my_Nrng, my_prng, my_qrng, my_σrng, my_τrng, device = :gpu)
Randomly initialize a binomial model ensemble with parameters uniformly sampled from the specified grid (on the GPU).
BinomialSynapses.BinomialModel
— TypeBinomialModel(N, p, q, σ, τ)
The standard structure for a binomial model or model ensemble.
Missing docstring for BinomialModel(Nmax::Integer, m_out::Integer, device::Symbol = :gpu)
. Check Documenter's build log for details.
BinomialSynapses.BinomialModel
— MethodBinomialModel(m_out, my_Nrng, my_prng, my_qrng, my_σrng, my_τrng)
Randomly initialize a binomial model ensemble on a grid, but throw away the grid info and just keep the parameters.
BinomialSynapses.BinomialModel
— MethodBinomialModel(model::BinomialGridModel)
Convert a BinomialGridModel
into a BinomialModel
.
BinomialSynapses.ScalarBinomialModel
— FunctionScalarBinomialModel(Nmax, device = :cpu)
Randomly initialize a model ensemble of size 1, which corresponds to a scalar model (used for the hidden state).
ScalarBinomialModel(N, p, q, σ, τ, device = :cpu)
Initialize a scalar binomial model with the given parameters.
Missing docstring for BinomialState(Nmax::Integer, m_out::Integer, m_in::Integer, device::Symbol = :gpu)
. Check Documenter's build log for details.
BinomialSynapses.ScalarBinomialState
— FunctionScalarBinomialState(Nmax, device = :cpu)
Randomly initialize a state ensemble of size 1, which corresponds to a scalar model (used for the hidden state).
ScalarBinomialState(n, k, device = :cpu)
Initialize a scalar state with the specified values of the variables.
BinomialSynapses.BinomialObservation
— TypeBinomialObservation
A structure for an observation consisting of an EPSP and a time step.
BinomialSynapses.propagate!
— Methodpropagate!(state, model, dt)
Propagate state
forward according to the model
, given a time step dt
.
BinomialSynapses.emit
— Functionemit(state, model, timestep)
Return a BinomialObservation
based on the current state
and model
, after a speficied time step timestep
.
emit(sim, dt)
Emit an EPSP after time step dt
.
Time steps
BinomialSynapses.Timestep
— TypeTimestep
An abstract type specifying the way a time step is chosen. The following basic types are supported:
FixedTimestep
: a constant, fixed number is usedRandomTimestep
: the time step is random from a fixed distributionOEDPolicy
: an optimal time step is chosen based on some objective function
BinomialSynapses.FixedTimestep
— TypeFixedTimestep(dt)
Choose a fixed time step of size `dt`.
BinomialSynapses.RandomTimestep
— TypeRandomTimestep(dist)
Choose a random time step from distribution dist
. There must be an implementation of rand
for typeof(dist)
.
Particle Filter
BinomialSynapses.NestedParticleFilter
— TypeNestedParticleFilter(jittering_width)
Construct a nested particle filter with a given jittering kernel width parameter.
BinomialSynapses.NestedParticleState
— TypeNestedParticleState(state, model)
Construct a particle system (ensemble) consisting of a state ensemble (inner and outer particles) and a model ensemble (outer particles).
BinomialSynapses.NestedParticleState
— MethodNestedParticleState(
m_out, m_in,
my_Nrng, my_prng, my_qrng, my_σrng, my_τrng,
device = :gpu
)
Construct a randomly initialized particle system with a given number of outer (m_out
) and inner (m_in
) particles and specified grids for the parameters.
BinomialSynapses.update!
— Methodupdate!(filterstate, obs, filter)
Update the particle filter state based on a given observation and filter.
BinomialSynapses.jitter!
— Functionjitter!(model::BinomialGridModel, width)
Apply jitter with parameter width
to the indices of a binomial model on a grid.
BinomialSynapses.likelihood
— Functionlikelihood(state, model::AbstractBinomialModel, obs)
Return the likelihood of an observation conditioned on the current state and model. This broadcasts properly over state and model ensemble, if they have compatible sizes.
BinomialSynapses.likelihood_resample!
— Functionlikelihood_resample!(state, model::AbstractBinomialModel, obs)
Return the likelihood of an observation conditioned on the current state and model ensemble and at the same time resample the state ensemble (inner particles).
BinomialSynapses.outer_resample!
— Functionouter_resample!(state, model, u)
Resample the outer particles of the state
and model
ensemble based on their likelihoods u
.
BinomialSynapses.indices!
— Functionindices!(v)
Return index table and total likelihoods from likelihood table v
. This function modifies v; after execution, v will be the cumulative sum of the original v along the last dimension.
BinomialSynapses.resample!
— Functionresample!(state, idx)
resample!(model, idx)
Resample the outer particles of state
or model
ensembles based on index table idx
.
OED
BinomialSynapses.OEDPolicy
— TypeOEDPolicy <: Timestep
An abstract type for choosing time steps based on optimizing a given cost function. This is provided in order to do active inference.
BinomialSynapses.policy
— Functionpolicy(sim)
Return the instance of OEDPolicy used in simulation sim
.
BinomialSynapses.Uniform
— TypeUniform(dts)
Randomly sample from a discrete set of time steps dts
. This is equivalent to, but more convenient to use than RandomTimestep(dist)
with dist
a uniform distribution on dts
.
BinomialSynapses.MyopicPolicy
— TypeMyopicPolicy <: OEDPolicy
A myopic OEDPolicy, i.e. one in which only the effect of the next time step on the parameter estimation, e.g. the entropy of a parameter, is taken into account.
BinomialSynapses.Myopic
— TypeMyopic(dts, target)
A parallel implementation of a myopic policy with candidate time steps dts
and optimization target target
, in which multiple copies of the particles are propagated in parallel. Implemented settings of target
: choose time step such that it
_entropy
: minimizes the joint entropy of the posterior distribution over parameters_tauentropy
: minimizes the marginal entropy ofτ
BinomialSynapses.MyopicFast
— TypeMyopicFast(dts, target)
MyopicFastis the same as
Myopic, except that instead of expanding states and parameters along another dimension, and propagating each parameter with each dt,
dtsare randomly assigned to members of the parameter ensemble. Implemented settings of
target`: choose time step such that it
_entropy
: minimizes the joint entropy of the posterior distribution over parameters_tauentropy
: minimizes the marginal entropy ofτ
BinomialSynapses.Myopic_tau
— FunctionMyopic_tau(dts)
Minimize the entropy of τ.
BinomialSynapses.MyopicFast_tau
— FunctionMyopicFast_tau(dts)
Minimize the entropy of τ.
Simulation
BinomialSynapses.NestedFilterSimulation
— TypeNestedFilterSimulation(hmodel, filter, hstate, fstate, tsteps, times, epsps)
This object stores static (hmodel
, filter
, tsteps
) and dynamic (hstate
, fstate
, tsteps
, times
, epsps
) information about the simulation.
BinomialSynapses.initialize!
— Functioninitialize!(sim)
Initialize the simulation.
BinomialSynapses.propagate!
— Methodpropagate!(sim)
Propagate the simulation, i.e. choose a time step and then propagate the simulation by it.
BinomialSynapses.run!
— Functionrun!(
sim;
T,
plot_each_timestep = false,
recording = NoRecording
)
Run a simulation for T
time steps. Set plot_each_timestep = true
to get a live update of the simulation (this will reduce performance) and set recording
to collect data while running the simulation (see Recording
).
BinomialSynapses.Recording
— TypeRecording(f1, f2, data)
A recording, which is stored in data
. The function f1
is something that is computed at each time step, whereas f2
is an operation that is applied after the simulation is finished.
BinomialSynapses.update!
— Methodupdate!(rec::Recording, sim, time)
Compute f1(sim, time)
and store it in rec.data
.