Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cross-entropy-method-0.0.4.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

cross_entropy_method-0.0.4-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file cross-entropy-method-0.0.4.tar.gz.

File metadata

  • Download URL: cross-entropy-method-0.0.4.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for cross-entropy-method-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9756ba57b146c50643b21240f216494c0c3d62f8716baf6a875430f9d503fceb
MD5 ca65b8d923698a574ab371257ae56e31
BLAKE2b-256 cb4c03b1cd99dd770190a077d48b5cc3ef13d6080cf3d221b292e11c43274d86

See more details on using hashes here.

Provenance

File details

Details for the file cross_entropy_method-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for cross_entropy_method-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7dc1ade825d4ad5671f7a76958feead867d58345bed188d89733109c246e8f99
MD5 a06112d7338e51835f8209f96e56dfd6
BLAKE2b-256 aca4517e6ed8bea4e8d3a23b78bb331611ea96f1d23183c01bc80b2690b7bbe7

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page