The Cross-Entropy Method for either rare-event sampling or optimization.
Project description
The Cross Entropy Method
The Cross Entropy Method (CE or CEM) is an approach for optimization or rare-event sampling in a given class of distributions {D_p} and a score function R(x).
- In its sampling version, it is given a reference p0 and aims to sample from the tail of the distribution x ~ (D_p0 | R(x)<q), where q is defined as either a numeric value q or a quantile alpha (where q=q_alpha(R)).
- In its optimization version, it aims to find argmin_x{R(x)}.
The exact implementation of the CEM depends on the problem setup.
This repo provides a general implementation as an abstract class, where a concrete use requires writing a simple, small inherited class.
The attached tutorial.ipynb
provides a more detailed background on the CEM and on this package, along with usage examples.
Installation: pip install cross-entropy-method
.
In our separate work, we demonstrate the use of the CEM for the more realistic problem of sampling "difficult" environment-conditions in risk-averse reinforcement learning. There, D_p determines the distribution of the environment-conditions, p0 corresponds to the original distribution (or test distribution), and R(x; agent) is the return function of the agent given the conditions x.
CEM for sampling (left): the mean of the sample distribution (blue) aims to coincide with the mean of the tail of the original distribution (black). CEM for optimization (right): the mean of the sample distribution aims to be minimized. (images from tutorial.ipynb ) |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cross-entropy-method-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d66b5db174749cc81a9a9e4e83ef6de09ba0670dd045ef5830ed414aac772af8 |
|
MD5 | 9c18624fdbfb8b5eccdfd9ceeac875b1 |
|
BLAKE2b-256 | a6cb6768a6c777076a24fee2f8a3baaf85ef75eb106355a718ac565250b5e3b2 |
Hashes for cross_entropy_method-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f6b94f4cb11dbd6ace14b2881ff424b971942db64d8305b609a614f122995a |
|
MD5 | 3bf02a71c4383d0fe43e83813d4a983d |
|
BLAKE2b-256 | ec237c715c2a839f9fd60a18ac7ea40588fa0407f86e6c121d9aeccda7c5c5ac |