Repository navigation
Minibatching compatability with CES, internalize flattening operations #436
Description
Issue
When using EnsembleKalmanProcesses.jl with several observations
CES will currently handle the limited setting of multiple minibatches but only if they are size 1
There is a small modifier to handle most cases we need though. By assuming that the minibatches are from different evaluations of a stochastic simulator, This is the most likely use case for most users data, as often the different data
for
In this case really we just require a flattening operation to be done by the user as follows:
- get_u and get_g eki iterations
- get the minibatch epochs.
- for each minibatch (size e.g. 3), duplicate any parameter "u" 3 times, and split the output "g" into it's un-batched form"g=[g_1,g_2,g_3]" , then flatten the list
(u,g_1), (u,g_2),(u, g_3) - create the training/test data from here and continue with "CES"
- Also modify encoder_kwargs to be consistent.
Note this is nice though, as it still allows for
- batches of different sizes (i.e. different numbers of y_i's)
- batches to overlap (i.e. a batches [1,2,3] and [2,3,4])
Improvement
As stated in the most broad sense, most users do (and all users should ) use batching in this way where we assume batches just stack observational "atoms" that are all statistically the same. In this way we can modify internal operations and default behaviour to capture this:
- the minibatcher should internalize this flattening so the user does not need to perform it externally
- We also directly extract encoder_kwargs (that may include e.g. output samples) from EKI, and these do not flatten the batches, this sould be updated to do so by default
Activity
odunbar commentedon Jun 24, 2026
To get the training data: replace the
get_training_iterations(eki,...)with the following:To use the right
encoder_kwargsfor the emulator: If just doingdecorrelator/default encoders then the following will work.This just avoids the EKI-based kwargs used in likelihood-informed encoders, which can also be modified but will be messier
In the MCMCWrapper just pass in the
osas the observation (as before)