diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 07f3296..c0391d2 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-10T09:18:11","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-10T10:08:07","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index b924345..c00d76a 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,9 +1,9 @@ -API reference · DifferentiableExpectations.jl

API reference

Public

DifferentiableExpectations.DifferentiableExpectationType
DifferentiableExpectation{threaded}

Abstract supertype for differentiable parametric expectations F : θ -> 𝔼[f(X)] where X ∼ p(θ), whose value and derivative are approximated with Monte-Carlo averages.

Type parameters

  • threaded::Bool: specifies whether the sampling should be performed in parallel (with OhMyThreads.jl)

Required fields

  • f: the function applied inside the expectation
  • dist_constructor: the constructor of the probability distribution, such that calling D(θ...) generates an object corresponding to p(θ)
  • rng: the random number generator
  • nb_samples: the number of Monte-Carlo samples
source
DifferentiableExpectations.FixedAtomsProbabilityDistributionType
FixedAtomsProbabilityDistribution

A probability distribution with finite support and fixed atoms.

Whenever its expectation is differentiated, only the weights are considered active, whereas the atoms are considered constant.

Fields

  • atoms::Vector

  • weights::Vector

source
DifferentiableExpectations.REINFORCEType
REINFORCE{threaded} <: DifferentiableExpectation{threaded}

Differentiable parametric expectation F : θ -> 𝔼[f(X)] where X ∼ p(θ) using the REINFORCE (or score function) gradient estimator:

∂F(θ) = 𝔼[f(X) ∇₁logp(θ, x)ᵀ]

Constructor

REINFORCE(
+API reference · DifferentiableExpectations.jl

API reference

Public

DifferentiableExpectations.DifferentiableExpectationType
DifferentiableExpectation{threaded}

Abstract supertype for differentiable parametric expectations F : θ -> 𝔼[f(X)] where X ∼ p(θ), whose value and derivative are approximated with Monte-Carlo averages.

Type parameters

  • threaded::Bool: specifies whether the sampling should be performed in parallel (with OhMyThreads.jl)

Required fields

  • f: the function applied inside the expectation
  • dist_constructor: the constructor of the probability distribution, such that calling D(θ...) generates an object corresponding to p(θ)
  • rng: the random number generator
  • nb_samples: the number of Monte-Carlo samples
source
DifferentiableExpectations.FixedAtomsProbabilityDistributionType
FixedAtomsProbabilityDistribution

A probability distribution with finite support and fixed atoms.

Whenever its expectation is differentiated, only the weights are considered active, whereas the atoms are considered constant.

Fields

  • atoms::Vector

  • weights::Vector{W} where W<:Real

source
DifferentiableExpectations.REINFORCEType
REINFORCE{threaded} <: DifferentiableExpectation{threaded}

Differentiable parametric expectation F : θ -> 𝔼[f(X)] where X ∼ p(θ) using the REINFORCE (or score function) gradient estimator:

∂F(θ) = 𝔼[f(X) ∇₁logp(θ, x)ᵀ]

Constructor

REINFORCE(
     f,
     dist_constructor,
     dist_gradlogpdf=nothing;
     rng=Random.default_rng(),
     nb_samples=1,
     threaded=false
-)

Fields

  • f::Any

  • dist_constructor::Any

  • dist_logdensity_grad::Any

  • rng::Random.AbstractRNG

  • nb_samples::Int64

See also

source

Private

+)

Fields

  • f::Any

  • dist_constructor::Any

  • dist_logdensity_grad::Any

  • rng::Random.AbstractRNG

  • nb_samples::Int64

See also

source

Private

diff --git a/dev/index.html b/dev/index.html index d3b7ba5..2881aa7 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · DifferentiableExpectations.jl
+Home · DifferentiableExpectations.jl
diff --git a/dev/search_index.js b/dev/search_index.js index 83124cd..6d47b2e 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"api/#API-reference","page":"API reference","title":"API reference","text":"","category":"section"},{"location":"api/#Public","page":"API reference","title":"Public","text":"","category":"section"},{"location":"api/","page":"API reference","title":"API reference","text":"Modules = [DifferentiableExpectations]\nPrivate = false","category":"page"},{"location":"api/#DifferentiableExpectations.DifferentiableExpectations","page":"API reference","title":"DifferentiableExpectations.DifferentiableExpectations","text":"DifferentiableExpectations\n\nA Julia package for differentiating through expectations with Monte-Carlo estimates.\n\nExports\n\nDifferentiableExpectation\nFixedAtomsProbabilityDistribution\nREINFORCE\n\n\n\n\n\n","category":"module"},{"location":"api/#DifferentiableExpectations.DifferentiableExpectation","page":"API reference","title":"DifferentiableExpectations.DifferentiableExpectation","text":"DifferentiableExpectation{threaded}\n\nAbstract supertype for differentiable parametric expectations F : θ -> 𝔼[f(X)] where X ∼ p(θ), whose value and derivative are approximated with Monte-Carlo averages.\n\nType parameters\n\nthreaded::Bool: specifies whether the sampling should be performed in parallel (with OhMyThreads.jl)\n\nRequired fields\n\nf: the function applied inside the expectation\ndist_constructor: the constructor of the probability distribution, such that calling D(θ...) generates an object corresponding to p(θ)\nrng: the random number generator\nnb_samples: the number of Monte-Carlo samples\n\n\n\n\n\n","category":"type"},{"location":"api/#DifferentiableExpectations.DifferentiableExpectation-Union{Tuple, Tuple{threaded}} where threaded","page":"API reference","title":"DifferentiableExpectations.DifferentiableExpectation","text":"(F::DifferentiableExpectation)(θ...; kwargs...)\n\nReturn a Monte-Carlo average (1/s) ∑f(xᵢ) where the xᵢ ∼ p(θ) are iid samples.\n\n\n\n\n\n","category":"method"},{"location":"api/#DifferentiableExpectations.FixedAtomsProbabilityDistribution","page":"API reference","title":"DifferentiableExpectations.FixedAtomsProbabilityDistribution","text":"FixedAtomsProbabilityDistribution\n\nA probability distribution with finite support and fixed atoms.\n\nWhenever its expectation is differentiated, only the weights are considered active, whereas the atoms are considered constant.\n\nFields\n\natoms::Vector\nweights::Vector\n\n\n\n\n\n","category":"type"},{"location":"api/#DifferentiableExpectations.REINFORCE","page":"API reference","title":"DifferentiableExpectations.REINFORCE","text":"REINFORCE{threaded} <: DifferentiableExpectation{threaded}\n\nDifferentiable parametric expectation F : θ -> 𝔼[f(X)] where X ∼ p(θ) using the REINFORCE (or score function) gradient estimator:\n\n∂F(θ) = 𝔼[f(X) ∇₁logp(θ, x)ᵀ]\n\nConstructor\n\nREINFORCE(\n f,\n dist_constructor,\n dist_gradlogpdf=nothing;\n rng=Random.default_rng(),\n nb_samples=1,\n threaded=false\n)\n\nFields\n\nf::Any\ndist_constructor::Any\ndist_logdensity_grad::Any\nrng::Random.AbstractRNG\nnb_samples::Int64\n\nSee also\n\nDifferentiableExpectation\n\n\n\n\n\n","category":"type"},{"location":"api/#Private","page":"API reference","title":"Private","text":"","category":"section"},{"location":"api/","page":"API reference","title":"API reference","text":"Modules = [DifferentiableExpectations]\nPublic = false","category":"page"},{"location":"api/#DifferentiableExpectations.presamples-Tuple{DifferentiableExpectation, Vararg{Any}}","page":"API reference","title":"DifferentiableExpectations.presamples","text":"presamples(F::DifferentiableExpectation, θ...)\n\nReturn a vector [x₁, ..., xₛ] or matrix [x₁ ... xₛ] where the xᵢ ∼ p(θ) are iid samples.\n\n\n\n\n\n","category":"method"},{"location":"api/#DifferentiableExpectations.samples-Union{Tuple{threaded}, Tuple{DifferentiableExpectation{threaded}, Vararg{Any}}} where threaded","page":"API reference","title":"DifferentiableExpectations.samples","text":"samples(F::DifferentiableExpectation, θ...; kwargs...)\n\nReturn a vector [f(x₁), ..., f(xₛ)] where the xᵢ ∼ p(θ) are iid samples.\n\n\n\n\n\n","category":"method"},{"location":"#DifferentiableExpectations.jl","page":"Home","title":"DifferentiableExpectations.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Dev) (Image: Build Status) (Image: Coverage) (Image: Code Style: Blue)","category":"page"},{"location":"","page":"Home","title":"Home","text":"This package revolves around functions defined as expectations:","category":"page"},{"location":"","page":"Home","title":"Home","text":"F(theta) = mathbbE_p_thetaf(X)","category":"page"},{"location":"","page":"Home","title":"Home","text":"It allows the computation of approximate derivatives with respect to theta thanks to Monte-Carlo samples.","category":"page"},{"location":"","page":"Home","title":"Home","text":"For more details, refer to the following paper:","category":"page"},{"location":"","page":"Home","title":"Home","text":"Monte-Carlo Gradient Estimation in Machine Learning, Mohamed et al. (2020)","category":"page"}] +[{"location":"api/#API-reference","page":"API reference","title":"API reference","text":"","category":"section"},{"location":"api/#Public","page":"API reference","title":"Public","text":"","category":"section"},{"location":"api/","page":"API reference","title":"API reference","text":"Modules = [DifferentiableExpectations]\nPrivate = false","category":"page"},{"location":"api/#DifferentiableExpectations.DifferentiableExpectations","page":"API reference","title":"DifferentiableExpectations.DifferentiableExpectations","text":"DifferentiableExpectations\n\nA Julia package for differentiating through expectations with Monte-Carlo estimates.\n\nExports\n\nDifferentiableExpectation\nFixedAtomsProbabilityDistribution\nREINFORCE\n\n\n\n\n\n","category":"module"},{"location":"api/#DifferentiableExpectations.DifferentiableExpectation","page":"API reference","title":"DifferentiableExpectations.DifferentiableExpectation","text":"DifferentiableExpectation{threaded}\n\nAbstract supertype for differentiable parametric expectations F : θ -> 𝔼[f(X)] where X ∼ p(θ), whose value and derivative are approximated with Monte-Carlo averages.\n\nType parameters\n\nthreaded::Bool: specifies whether the sampling should be performed in parallel (with OhMyThreads.jl)\n\nRequired fields\n\nf: the function applied inside the expectation\ndist_constructor: the constructor of the probability distribution, such that calling D(θ...) generates an object corresponding to p(θ)\nrng: the random number generator\nnb_samples: the number of Monte-Carlo samples\n\n\n\n\n\n","category":"type"},{"location":"api/#DifferentiableExpectations.DifferentiableExpectation-Union{Tuple, Tuple{threaded}} where threaded","page":"API reference","title":"DifferentiableExpectations.DifferentiableExpectation","text":"(F::DifferentiableExpectation)(θ...; kwargs...)\n\nReturn a Monte-Carlo average (1/s) ∑f(xᵢ) where the xᵢ ∼ p(θ) are iid samples.\n\n\n\n\n\n","category":"method"},{"location":"api/#DifferentiableExpectations.FixedAtomsProbabilityDistribution","page":"API reference","title":"DifferentiableExpectations.FixedAtomsProbabilityDistribution","text":"FixedAtomsProbabilityDistribution\n\nA probability distribution with finite support and fixed atoms.\n\nWhenever its expectation is differentiated, only the weights are considered active, whereas the atoms are considered constant.\n\nFields\n\natoms::Vector\nweights::Vector{W} where W<:Real\n\n\n\n\n\n","category":"type"},{"location":"api/#DifferentiableExpectations.REINFORCE","page":"API reference","title":"DifferentiableExpectations.REINFORCE","text":"REINFORCE{threaded} <: DifferentiableExpectation{threaded}\n\nDifferentiable parametric expectation F : θ -> 𝔼[f(X)] where X ∼ p(θ) using the REINFORCE (or score function) gradient estimator:\n\n∂F(θ) = 𝔼[f(X) ∇₁logp(θ, x)ᵀ]\n\nConstructor\n\nREINFORCE(\n f,\n dist_constructor,\n dist_gradlogpdf=nothing;\n rng=Random.default_rng(),\n nb_samples=1,\n threaded=false\n)\n\nFields\n\nf::Any\ndist_constructor::Any\ndist_logdensity_grad::Any\nrng::Random.AbstractRNG\nnb_samples::Int64\n\nSee also\n\nDifferentiableExpectation\n\n\n\n\n\n","category":"type"},{"location":"api/#Private","page":"API reference","title":"Private","text":"","category":"section"},{"location":"api/","page":"API reference","title":"API reference","text":"Modules = [DifferentiableExpectations]\nPublic = false","category":"page"},{"location":"api/#DifferentiableExpectations.presamples-Tuple{DifferentiableExpectation, Vararg{Any}}","page":"API reference","title":"DifferentiableExpectations.presamples","text":"presamples(F::DifferentiableExpectation, θ...)\n\nReturn a vector [x₁, ..., xₛ] or matrix [x₁ ... xₛ] where the xᵢ ∼ p(θ) are iid samples.\n\n\n\n\n\n","category":"method"},{"location":"api/#DifferentiableExpectations.samples-Union{Tuple{threaded}, Tuple{DifferentiableExpectation{threaded}, Vararg{Any}}} where threaded","page":"API reference","title":"DifferentiableExpectations.samples","text":"samples(F::DifferentiableExpectation, θ...; kwargs...)\n\nReturn a vector [f(x₁), ..., f(xₛ)] where the xᵢ ∼ p(θ) are iid samples.\n\n\n\n\n\n","category":"method"},{"location":"#DifferentiableExpectations.jl","page":"Home","title":"DifferentiableExpectations.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Dev) (Image: Build Status) (Image: Coverage) (Image: Code Style: Blue)","category":"page"},{"location":"","page":"Home","title":"Home","text":"This package revolves around functions defined as expectations:","category":"page"},{"location":"","page":"Home","title":"Home","text":"F(theta) = mathbbE_p_thetaf(X)","category":"page"},{"location":"","page":"Home","title":"Home","text":"It allows the computation of approximate derivatives with respect to theta thanks to Monte-Carlo samples.","category":"page"},{"location":"","page":"Home","title":"Home","text":"For more details, refer to the following paper:","category":"page"},{"location":"","page":"Home","title":"Home","text":"Monte-Carlo Gradient Estimation in Machine Learning, Mohamed et al. (2020)","category":"page"}] }