{"id":31021373,"url":"https://github.com/sisl/crossentropymethod.jl","last_synced_at":"2025-10-06T15:04:19.977Z","repository":{"id":48965099,"uuid":"268363414","full_name":"sisl/CrossEntropyMethod.jl","owner":"sisl","description":"An implementation of the cross entropy method that works well for time series","archived":false,"fork":false,"pushed_at":"2022-01-13T20:44:58.000Z","size":36,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-13T12:26:42.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sisl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-31T21:01:21.000Z","updated_at":"2022-12-03T03:47:07.000Z","dependencies_parsed_at":"2022-09-24T01:00:22.201Z","dependency_job_id":null,"html_url":"https://github.com/sisl/CrossEntropyMethod.jl","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sisl/CrossEntropyMethod.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FCrossEntropyMethod.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FCrossEntropyMethod.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FCrossEntropyMethod.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FCrossEntropyMethod.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sisl","download_url":"https://codeload.github.com/sisl/CrossEntropyMethod.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FCrossEntropyMethod.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278629053,"owners_count":26018483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-13T11:20:55.133Z","updated_at":"2025-10-06T15:04:19.932Z","avatar_url":"https://github.com/sisl.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CrossEntropyMethod.jl\n[![Build Status](https://travis-ci.org/sisl/CrossEntropyMethod.jl.svg?branch=master)](https://travis-ci.org/sisl/CrossEntropyMethod.jl) [![Coverage Status](https://coveralls.io/repos/github/sisl/CrossEntropyMethod.jl/badge.svg?branch=master)](https://coveralls.io/github/sisl/CrossEntropyMethod.jl?branch=master) [![codecov](https://codecov.io/gh/sisl/CrossEntropyMethod.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/sisl/CrossEntropyMethod.jl)\n\nThis package provides an implementation of the cross entropy method for optimizing multivariate time series distributions.\nSuppose we have a timeseries `X = {x₁, ..., xₙ}` where each `xᵢ` is a vector of dimension `m`. This package provides optimization for two different scenarios:\n1. The time series is sampled IID from a single distribution `p`: `xᵢ ~ p(x)`. In this case, the distribution is represented as a `Dict{Symbol, Tuple{Sampleable, Int64}}`. The dictionary will contain `m` symbols, one for each variable in the series. The `Sampleable` object represents `p` and the integer is the length of the timeseries (`N`)\n2. 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 a `Dict{Symbol, Tuple{Sampleable, Int64}}`.\n\nNote: The `Sampleable` objects must support the `Distributions.jl` function `logpdf` and `fit`.\n\n## Usage\nSee the `examples/` folder for an example use case.\nThe main function is `cross_entropy_method` and has the following parameters:\n* `loss::Function` - The loss function. No default.\n* `d_in` - The starting sampling distribution. No default.\n* `max_iter` - Maximum number of iterations, No default.\n* `N` - The population size. Default: `100`\n* `elite_thresh` - The threshold below which a sample will be considered elite. To have a fixed number of elite samples set this to `-Inf` and use the `min_elite_samples` parameter. Default: `-0.99`\n* `min_elite_samples` - The minimum number of elite samples. Default: `Int64(floor(0.1*N))`\n* `max_elite_samples` - The maximum number of allowed elite samples.  Default: `typemax(Int64)`\n* `weight_fn` - A function that specifies the weight of each sample. Use the likelihood ratio when trying to perform importance sampling. Default `(d,x) -\u003e 1`\n* `rng::AbstractRNG` - The random number generator used. Default: `Random.GLOBAL_RNG`\n* `verbose` - Whether or not to print progress. Default: `false`\n* `show_progress` - Whether or not to show the progress meter. Default: `false`\n* `batched` - Indicates batched loss evaluation (loss function must return an array containing loss values for each sample). Default: `false`\n* `add_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)-\u003ex`\n\n\n\nMaintained by Anthony Corso (acorso@stanford.edu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisl%2Fcrossentropymethod.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsisl%2Fcrossentropymethod.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisl%2Fcrossentropymethod.jl/lists"}