You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow users to provide a batching mechanism and list of observations and corresponding noise
Solution (Updated)
Overhaul the existing Observation object and construct a new ObservationSeries object.
The Observations can be combined and stacked to build new Observations (akin to the ParameterDistribution objects).
Then the ObservationSeries will take a vector of such Observations and a Minibatcher mechanism that will sample epochs of the provided series.
EKP now builds and stores Observation quantities (like obs_mean and obs_noise_cov inside an ObservationSeries object), so all calls to .obs_mean and .obs_noise_cov will now be getter function from the ObservationSeries object and will provide the current minibatch.
The key objects and methods for this solution:
The individual (possibly stacked) Observation
struct Observation
samples::Vector{Vector}# list of observation samples
covs::Vector{Matrix}# list of covs for each observations
names::Vector{String}# names of the observation samples
indices::Vector{UnitRange}# indices of each for stacking the Observation (necessary?)end
The series of Observations for batching
struct ObservationSeries
observations::Vector{Observation}# vector of observations
batches::Vector{Vector}# batches grouped by epoch
current_batch_index::Dict# holds 2 indices (epoch#, batch#) of the latest batch
batcher<:MiniBatcher# Object to construct the next epoch of batches
names::Vector String # holds id's for the observation samplesend
Simple instance for batching into batch_size batches
struct RandomMiniBatcher <:MiniBatcher
batch_size::Int
n_samples_per_epoch::Int
rng::GlobalRNGendfunctiongenerate_batches_for_epoch(b::RandomMiniBatcher)
N =get_n_samples_per_epoch(b)
rng =get_rng(b)
indices =shuffle(rng, collect(1:N))
bs =get_batch_size(b)
n_batches =Int(floor(N/bs))
return [ i < n_batches ?
indices[ (i-1) *batch_size+1: i*batch_size] :# bs sized batches
indices[ n_batches*batch_size+1:end] # final large batch < 2*bs sizedfor i =1:n_batches
]
end
The Observation object will update the batch at the end of the EKP update with a manual call to "update batch index" that will either iterate current_batch_index, or will make a call to the MiniBatchers to start a new epoch.
The text was updated successfully, but these errors were encountered:
Allow users to provide a batching mechanism and list of observations and corresponding noise
Solution (Updated)
Overhaul the existing
Observation
object and construct a newObservationSeries
object.Observation
s can be combined and stacked to build newObservation
s (akin to theParameterDistribution
objects).ObservationSeries
will take a vector of suchObservation
s and aMinibatcher
mechanism that will sample epochs of the provided series.obs_mean
andobs_noise_cov
inside anObservationSeries
object), so all calls to.obs_mean
and.obs_noise_cov
will now be getter function from theObservationSeries
object and will provide the current minibatch.The key objects and methods for this solution:
Some forms of the
Minibatcher
The Batches are created by the following object, and its method:
Simple instance for default/fixed batches by user
Simple instance for batching into
batch_size
batchescurrent_batch_index
, or will make a call to theMiniBatchers
to start a new epoch.The text was updated successfully, but these errors were encountered: