This package provides an implementation of the cross entropy method for optimizing multivariate time series distributions.
Suppose we have a timeseries X = {x₁, ..., xₙ} where each xᵢ is a vector of dimension m. This package provides optimization for two different scenarios:
- The time series is sampled IID from a single distribution
p:xᵢ ~ p(x). In this case, the distribution is represented as aDict{Symbol, Tuple{Sampleable, Int64}}. The dictionary will containmsymbols, one for each variable in the series. TheSampleableobject representspand the integer is the length of the timeseries (N) - The time series is sampled from a different distribution at each timestep
pᵢ:xᵢ ~ pᵢ(x). In this case, the distribution is also represented as aDict{Symbol, Tuple{Sampleable, Int64}}.
Note: The Sampleable objects must support the Distributions.jl function logpdf and fit.
See the examples/ folder for an example use case.
The main function is cross_entropy_method and has the following parameters:
loss::Function- The loss function. No default.d_in- The starting sampling distribution. No default.max_iter- Maximum number of iterations, No default.N- The population size. Default:100elite_thresh- The threshold below which a sample will be considered elite. To have a fixed number of elite samples set this to-Infand use themin_elite_samplesparameter. Default:-0.99min_elite_samples- The minimum number of elite samples. Default:Int64(floor(0.1*N))max_elite_samples- The maximum number of allowed elite samples. Default:typemax(Int64)weight_fn- A function that specifies the weight of each sample. Use the likelihood ratio when trying to perform importance sampling. Default(d,x) -> 1rng::AbstractRNG- The random number generator used. Default:Random.GLOBAL_RNGverbose- Whether or not to print progress. Default:falseshow_progress- Whether or not to show the progress meter. Default:falsebatched- Indicates batched loss evaluation (loss function must return an array containing loss values for each sample). Default:falseadd_entropy- A function that transforms the sampling distribution after fitting. Use it to enforce a maximum level of entropy if converging too quickly. Default:(x)->x
Maintained by Anthony Corso (acorso@stanford.edu)