ClosedFormExpectations.jl
ClosedFormExpectations.jl
is a Julia package that provides closed-form expressions for computing the expectation of a function (e.g pdfs) with respect to another distribution, i.e., $E_q[f(x)].$
Installation
You can install ClosedFormExpectations.jl
using the Julia package manager. From the Julia REPL, type ]
to enter the Pkg REPL mode and run:
pkg> add ClosedFormExpectations
The package exports the following:
ClosedFormExpectation
: A struct representing the closed-form expectation
ClosedWilliamsProduct
: A struct representing the closed-form expectation of the product of score function and a target function (the gradient of the ClosedFormExpectation
)
Usage
using ClosedFormExpectations
using Distributions
mean(ClosedFormExpectation(), Exponetial(10), log)