From 717615bdc6d8e028468c95e00995cf5799580f8d Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 20 Aug 2024 12:43:46 +0000 Subject: [PATCH] build based on 408f55f --- dev/.documenter-siteinfo.json | 2 +- ...{index-b4328eb6.svg => index-9a9ff99e.svg} | 120 ++++++++-------- ...{index-66335ec9.svg => index-e599e403.svg} | 136 +++++++++--------- dev/index.html | 14 +- dev/objects.inv | Bin 425 -> 425 bytes 5 files changed, 136 insertions(+), 136 deletions(-) rename dev/{index-b4328eb6.svg => index-9a9ff99e.svg} (79%) rename dev/{index-66335ec9.svg => index-e599e403.svg} (85%) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 2e3c62b..27c51b1 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-20T10:55:34","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-20T12:43:43","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/index-b4328eb6.svg b/dev/index-9a9ff99e.svg similarity index 79% rename from dev/index-b4328eb6.svg rename to dev/index-9a9ff99e.svg index bcab3ab..3ebc410 100644 --- a/dev/index-b4328eb6.svg +++ b/dev/index-9a9ff99e.svg @@ -1,74 +1,74 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/index-66335ec9.svg b/dev/index-e599e403.svg similarity index 85% rename from dev/index-66335ec9.svg rename to dev/index-e599e403.svg index 52f58c9..71ddcdb 100644 --- a/dev/index-66335ec9.svg +++ b/dev/index-e599e403.svg @@ -1,82 +1,82 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/index.html b/dev/index.html index 677a807..08b1aec 100644 --- a/dev/index.html +++ b/dev/index.html @@ -5,22 +5,22 @@ true julia> ExponentialFamilyManifolds.get_natural_manifold(MvNormalMeanCovariance, (3, )) isa ExponentialFamilyManifolds.NaturalParametersManifold -truesource

The get_natural_manifold function returns NaturalParametersManifold manifold, which is a wrapper around the actual manifold (the base) for the natural parameters that stores extra useful properties and provides the necessary operations for optimization with Manopt.jl.

using ExponentialFamilyManifolds, ExponentialFamily
+true
source

The get_natural_manifold function returns NaturalParametersManifold manifold, which is a wrapper around the actual manifold (the base) for the natural parameters that stores extra useful properties and provides the necessary operations for optimization with Manopt.jl.

using ExponentialFamilyManifolds, ExponentialFamily
 
-ExponentialFamilyManifolds.get_natural_manifold(Beta, (), nothing)
ExponentialFamilyManifolds.NaturalParametersManifold{ℝ, Distributions.Beta, Tuple{}, ManifoldsBase.ProductManifold{ℝ, Tuple{ExponentialFamilyManifolds.ShiftedPositiveNumbers{Static.StaticInt{-1}}, ExponentialFamilyManifolds.ShiftedPositiveNumbers{Static.StaticInt{-1}}}}, Nothing}((), ProductManifold(ShiftedPositiveNumbers(static(-1)), ShiftedPositiveNumbers(static(-1))), nothing)
ExponentialFamilyManifolds.NaturalParametersManifoldType
NaturalParametersManifold(::Type{T}, dims, base, conditioner)

The manifold for the natural parameters of the distribution of type T with dimensions dims. An internal structure, use get_natural_manifold to create an instance of a manifold for the natural parameters of distribution of type T.

source

Its not advised to use the NaturalParametersManifold to create a manifold, but instead use the get_natural_manifold function.


Natural manifold base

The get_natural_manifold_base function returns the base manifold without the wrapper.

ExponentialFamilyManifolds.get_natural_manifold_base(Beta, (), nothing)
ProductManifold with 2 submanifolds:
+ExponentialFamilyManifolds.get_natural_manifold(Beta, (), nothing)
ExponentialFamilyManifolds.NaturalParametersManifold{ℝ, Distributions.Beta, Tuple{}, ManifoldsBase.ProductManifold{ℝ, Tuple{ExponentialFamilyManifolds.ShiftedPositiveNumbers{Static.StaticInt{-1}}, ExponentialFamilyManifolds.ShiftedPositiveNumbers{Static.StaticInt{-1}}}}, Nothing}((), ProductManifold(ShiftedPositiveNumbers(static(-1)), ShiftedPositiveNumbers(static(-1))), nothing)
ExponentialFamilyManifolds.NaturalParametersManifoldType
NaturalParametersManifold(::Type{T}, dims, base, conditioner)

The manifold for the natural parameters of the distribution of type T with dimensions dims. An internal structure, use get_natural_manifold to create an instance of a manifold for the natural parameters of distribution of type T.

source

Its not advised to use the NaturalParametersManifold to create a manifold, but instead use the get_natural_manifold function.


Natural manifold base

The get_natural_manifold_base function returns the base manifold without the wrapper.

ExponentialFamilyManifolds.get_natural_manifold_base(Beta, (), nothing)
ProductManifold with 2 submanifolds:
  ShiftedPositiveNumbers(static(-1))
  ShiftedPositiveNumbers(static(-1))

The base manifold, however, does not encode the information about the conditioner, hence, it cannot be used for all exponential members. Additionally, it does not encode the type of the underlying exponential family members. For instance, the LogNormal and the univariate Normal distribution share the same base manifold, yet they represent different members of the exponential family of distributions.

ExponentialFamilyManifolds.get_natural_manifold_baseFunction
get_natural_manifold_base(M::NaturalParametersManifold)
-get_natural_manifold_base(::Type{T}, dims, conditioner = nothing)

Returns base manifold for the distribution of type T of dimension dims. Optionally accepts the conditioner, which is set to nothing by default.

source
get_natural_manifold_base(::Type{Bernoulli}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Bernoulli distribution.

source
get_natural_manifold_base(::Type{Beta}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Beta distribution.

source
get_natural_manifold_base(::Type{Binomial}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Binomial distribution.

source
get_natural_manifold_base(::Type{Chisq}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Chisq distribution.

source
get_natural_manifold_base(::Type{Categorical}, dims::Tuple{Int}, conditioner=nothing)

Get the natural manifold base for the Categorical distribution.

source
get_natural_manifold_base(::Type{Dirichlet}, dims::Tuple{Int}, conditioner=nothing)

Get the natural manifold base for the Dirichlet distribution.

source
get_natural_manifold_base(::Type{Exponential}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Exponential distribution.

source
get_natural_manifold_base(::Type{Gamma}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Gamma distribution.

source
get_natural_manifold_base(::Type{ExponentialFamily.GammaInverse}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the ExponentialFamily.GammaInverse distribution.

source
get_natural_manifold_base(::Type{Geometric}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Geometric distribution.

source
get_natural_manifold_base(::Type{Laplace}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Laplace distribution.

source
get_natural_manifold_base(::Type{LogNormal}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the LogNormal distribution.

source
get_natural_manifold_base(::Type{NormalMeanVariance}, ::Tuple{}, conditioner = nothing)

Get the natural manifold base for the NormalMeanVariance distribution.

source
get_natural_manifold_base(::Type{MvNormalMeanCovariance}, dims::Tuple{Int}, conditioner = nothing)

Get the natural manifold base for the MvNormalMeanCovariance distribution.

source
get_natural_manifold_base(::Type{NegativeBinomial}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the NegativeBinomial distribution.

source
get_natural_manifold_base(::Type{Pareto}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Pareto distribution.

source
get_natural_manifold_base(::Type{Poisson}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Poisson distribution.

source
get_natural_manifold_base(::Type{Rayleigh}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Rayleigh distribution.

source
get_natural_manifold_base(::Type{Weibull}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Weibull distribution.

source
get_natural_manifold_base(::Type{WishartFast}, ::Tuple{Int}, conditioner=nothing)

Get the natural manifold base for the WishartFast distribution.

source

Product manifolds

Some base manifolds are known as Product Manifolds, which consist of several manifolds combined together. For example, the natural parameters of a multivariate Normal distribution form a product of a Euclidean vector manifold and a symmetric negative definite matrix manifold. The partition_point function takes a plain vector of natural parameters and (typically, but not always) returns a partitioned array for each submanifold in the form of an ArrayPartition from RecursiveArrayTools.jl.

M = ExponentialFamilyManifolds.get_natural_manifold(Beta, (), nothing)
+get_natural_manifold_base(::Type{T}, dims, conditioner = nothing)

Returns base manifold for the distribution of type T of dimension dims. Optionally accepts the conditioner, which is set to nothing by default.

source
get_natural_manifold_base(::Type{Bernoulli}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Bernoulli distribution.

source
get_natural_manifold_base(::Type{Beta}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Beta distribution.

source
get_natural_manifold_base(::Type{Binomial}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Binomial distribution.

source
get_natural_manifold_base(::Type{Chisq}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Chisq distribution.

source
get_natural_manifold_base(::Type{Categorical}, dims::Tuple{Int}, conditioner=nothing)

Get the natural manifold base for the Categorical distribution.

source
get_natural_manifold_base(::Type{Dirichlet}, dims::Tuple{Int}, conditioner=nothing)

Get the natural manifold base for the Dirichlet distribution.

source
get_natural_manifold_base(::Type{Exponential}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Exponential distribution.

source
get_natural_manifold_base(::Type{Gamma}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Gamma distribution.

source
get_natural_manifold_base(::Type{ExponentialFamily.GammaInverse}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the ExponentialFamily.GammaInverse distribution.

source
get_natural_manifold_base(::Type{Geometric}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Geometric distribution.

source
get_natural_manifold_base(::Type{Laplace}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Laplace distribution.

source
get_natural_manifold_base(::Type{LogNormal}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the LogNormal distribution.

source
get_natural_manifold_base(::Type{NormalMeanVariance}, ::Tuple{}, conditioner = nothing)

Get the natural manifold base for the NormalMeanVariance distribution.

source
get_natural_manifold_base(::Type{MvNormalMeanCovariance}, dims::Tuple{Int}, conditioner = nothing)

Get the natural manifold base for the MvNormalMeanCovariance distribution.

source
get_natural_manifold_base(::Type{NegativeBinomial}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the NegativeBinomial distribution.

source
get_natural_manifold_base(::Type{Pareto}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Pareto distribution.

source
get_natural_manifold_base(::Type{Poisson}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Poisson distribution.

source
get_natural_manifold_base(::Type{Rayleigh}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Rayleigh distribution.

source
get_natural_manifold_base(::Type{Weibull}, ::Tuple{}, conditioner=nothing)

Get the natural manifold base for the Weibull distribution.

source
get_natural_manifold_base(::Type{WishartFast}, ::Tuple{Int}, conditioner=nothing)

Get the natural manifold base for the WishartFast distribution.

source

Product manifolds

Some base manifolds are known as Product Manifolds, which consist of several manifolds combined together. For example, the natural parameters of a multivariate Normal distribution form a product of a Euclidean vector manifold and a symmetric negative definite matrix manifold. The partition_point function takes a plain vector of natural parameters and (typically, but not always) returns a partitioned array for each submanifold in the form of an ArrayPartition from RecursiveArrayTools.jl.

M = ExponentialFamilyManifolds.get_natural_manifold(Beta, (), nothing)
 p = ExponentialFamilyManifolds.partition_point(M, [ 1.0, 2.0 ])
([1.0], [2.0])
typeof(p)
RecursiveArrayTools.ArrayPartition{Float64, Tuple{SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}}}

The partitioned point functions as a regular vector but encodes the structure of the product manifold, allowing differentiation between the submanifolds within the vector.

ExponentialFamilyManifolds.ManifoldsBase.submanifold_component(p, 1)
1-element view(::Vector{Float64}, 1:1) with eltype Float64:
  1.0
ExponentialFamilyManifolds.ManifoldsBase.submanifold_component(p, 2)
1-element view(::Vector{Float64}, 2:2) with eltype Float64:
  2.0
ExponentialFamilyManifolds.partition_pointFunction
partition_point(M::NaturalParametersManifold, p)
-partition_point(::Type{T}, dims, point, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold M of type T.

source
partition_point(::Type{Bernoulli}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Bernoulli.

source
partition_point(::Type{Beta}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Beta.

source
partition_point(::Type{Binomial}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Binomial.

source
partition_point(::Type{Chisq}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Chisq.

source
partition_point(::Type{Categorical}, dims::Tuple{Int}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Categorical.

source
partition_point(::Type{Dirichlet}, dims::Tuple{Int}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Dirichlet.

source
partition_point(::Type{Exponential}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Exponential.

source
partition_point(::Type{Gamma}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Gamma.

source
partition_point(::Type{ExponentialFamily.GammaInverse}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type ExponentialFamily.GammaInverse.

source
partition_point(::Type{Geometric}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Geometric.

source
partition_point(::Type{Laplace}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Laplace.

source
partition_point(::Type{LogNormal}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type LogNormal.

source
partition_point(::Type{NormalMeanVariance}, ::Tuple{}, p, conditioner = nothing)

Converts the point to a compatible representation for the natural manifold of type NormalMeanVariance.

source
partition_point(::Type{MvNormalMeanCovariance}, dims::Tuple{Int}, p, conditioner = nothing)

Converts the point to a compatible representation for the natural manifold of type MvNormalMeanCovariance.

source
partition_point(::Type{NegativeBinomial}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type NegativeBinomial.

source
partition_point(::Type{Pareto}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Pareto.

source
partition_point(::Type{Poisson}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Poisson.

source
partition_point(::Type{Rayleigh}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Laplace.

source
partition_point(::Type{Weibull}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Weibull.

source
partition_point(::Type{WishartFast}, ::Tuple{Int}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type WishartFast.

source

Custom generic manifolds

ExponentialFamilyManifolds.jl introduces additional manifolds not included in Manifolds.jl. This is crucial because certain exponential family distributions have natural parameters that require specific manifolds, such as negative definite matrices for the multivariate Gaussian distribution. These manifolds do not implement every operation defined in ManifoldsBase.jl, but they do provide the essential operations needed for optimization with Manopt.jl.

Optimization example

Suppose, we have a set of samples from a certain exponential family distribution and we want to estimate the natural parameters of the distribution using the Manopt.jl package.

using ExponentialFamily, Distributions, Plots, StableRNGs
+partition_point(::Type{T}, dims, point, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold M of type T.

source
partition_point(::Type{Bernoulli}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Bernoulli.

source
partition_point(::Type{Beta}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Beta.

source
partition_point(::Type{Binomial}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Binomial.

source
partition_point(::Type{Chisq}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Chisq.

source
partition_point(::Type{Categorical}, dims::Tuple{Int}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Categorical.

source
partition_point(::Type{Dirichlet}, dims::Tuple{Int}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Dirichlet.

source
partition_point(::Type{Exponential}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Exponential.

source
partition_point(::Type{Gamma}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Gamma.

source
partition_point(::Type{ExponentialFamily.GammaInverse}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type ExponentialFamily.GammaInverse.

source
partition_point(::Type{Geometric}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Geometric.

source
partition_point(::Type{Laplace}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Laplace.

source
partition_point(::Type{LogNormal}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type LogNormal.

source
partition_point(::Type{NormalMeanVariance}, ::Tuple{}, p, conditioner = nothing)

Converts the point to a compatible representation for the natural manifold of type NormalMeanVariance.

source
partition_point(::Type{MvNormalMeanCovariance}, dims::Tuple{Int}, p, conditioner = nothing)

Converts the point to a compatible representation for the natural manifold of type MvNormalMeanCovariance.

source
partition_point(::Type{NegativeBinomial}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type NegativeBinomial.

source
partition_point(::Type{Pareto}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Pareto.

source
partition_point(::Type{Poisson}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Poisson.

source
partition_point(::Type{Rayleigh}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Laplace.

source
partition_point(::Type{Weibull}, ::Tuple{}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type Weibull.

source
partition_point(::Type{WishartFast}, ::Tuple{Int}, p, conditioner=nothing)

Converts the point to a compatible representation for the natural manifold of type WishartFast.

source

Custom generic manifolds

ExponentialFamilyManifolds.jl introduces additional manifolds not included in Manifolds.jl. This is crucial because certain exponential family distributions have natural parameters that require specific manifolds, such as negative definite matrices for the multivariate Gaussian distribution. These manifolds do not implement every operation defined in ManifoldsBase.jl, but they do provide the essential operations needed for optimization with Manopt.jl.

Optimization example

Suppose, we have a set of samples from a certain exponential family distribution and we want to estimate the natural parameters of the distribution using the Manopt.jl package.

using ExponentialFamily, Distributions, Plots, StableRNGs
 
 rng  = StableRNG(42)
 dist = Beta(24, 6)
 data = rand(rng, dist, 200)
 
-histogram(data, xlim = (0, 1), label = "data", normalize=:pdf)
Example block output
using Manopt, ForwardDiff, ExponentialFamilyManifolds
+histogram(data, xlim = (0, 1), label = "data", normalize=:pdf)
Example block output
using Manopt, ForwardDiff, ExponentialFamilyManifolds
 
 # cost function
 function f(M, p)
@@ -42,7 +42,7 @@
  21.396819066270247
   5.357726910129818

As we can see the result is quite close to the actual distribution, which was used to generate the test data:

params(MeanParametersSpace(), dist)
(24.0, 6.0)

Let's also check the result, by plotting the estimated distribution on top of the data.

histogram(data, xlim = (0, 1), label = "data", normalize=:pdf, fillalpha = 0.3)
 plot!(0.0:0.01:1.0, (x) -> pdf(dist, x), label = "actual", fill = 0, fillalpha = 0.2)
-plot!(0.0:0.01:1.0, (x) -> pdf(q_ef, x), label = "estimated", fill = 0, fillalpha = 0.5)
Example block output

The difference in KL is quite small as well:

kldivergence(convert(Distribution, q_ef), dist)
0.0035633924185827226

Helpers

ExponentialFamilyManifolds.NegatedType
Negated(m)

Lazily negates the matrix m, without creating a new matrix. Works by redefining the getindex.

julia> using ExponentialFamilyManifolds
+plot!(0.0:0.01:1.0, (x) -> pdf(q_ef, x), label = "estimated", fill = 0, fillalpha = 0.5)
Example block output

The difference in KL is quite small as well:

kldivergence(convert(Distribution, q_ef), dist)
0.0035633924185827226

Helpers

ExponentialFamilyManifolds.NegatedType
Negated(m)

Lazily negates the matrix m, without creating a new matrix. Works by redefining the getindex.

julia> using ExponentialFamilyManifolds
 
 julia> m = [1 2; 3 4]
 2×2 Matrix{Int64}:
@@ -55,4 +55,4 @@
  -3  -4
 
 julia> N[1, 2]
--2
source

Index

+-2source

Index

diff --git a/dev/objects.inv b/dev/objects.inv index 8f4f8b1b79897f1dc930963eb6ed12b46b9de47b..b721886ff095e2869039aab29325d4d71414f6c0 100644 GIT binary patch delta 14 VcmZ3