ExponentialFamilyManifolds.jl provides implementations of manifolds for the natural parameters of exponential family distributions, using Manifolds.jl. These manifolds are compatible with ManifoldsBase.jl, enabling optimization of the natural parameters of exponential family distributions using Manopt.jl.
Refer to the documentation for more information and optimization examples.
First, install the package:
using Pkg
Pkg.add("ExponentialFamilyManifolds")To use the package, you'll need to have the distribution types exported from ExponentialFamily.jl and methods from Manifolds.jl. Here's a basic example showing how to work with a Beta distribution:
using ExponentialFamily, ExponentialFamilyManifolds, Manifolds
# Create a Beta distribution
dist = Beta(2.0, 3.0)
# Convert to exponential family form
ef = convert(ExponentialFamilyDistribution, dist)
# Get the natural manifold for the Beta distribution
M = ExponentialFamilyManifolds.get_natural_manifold(Beta, ())
# Get natural parameters
η = getnaturalparameters(ef)
# Create a point on the manifold
p = ExponentialFamilyManifolds.partition_point(M, η)
# Create a tangent vector at point p
X = rand(M, vector_at = p)
# Move along the manifold in direction X with step size 0.1
q = Manifolds.retract_fused(M, p, X, 0.1)
# Convert back to exponential family distribution
ef_new = convert(ExponentialFamilyDistribution, M, q)For a more advanced example, you can use Manopt.jl to optimize the natural parameters of exponential family distributions. Here's what you can do:
- Optimize maximum likelihood estimation
- Work with different cost functions on the manifold
- Use various optimization algorithms (gradient descent, conjugate gradient, etc.)
Check out our optimization example in the documentation to learn more.
We welcome contributions and questions from the community! Here's how you can get involved:
-
Q&A and Discussions: Have questions or want to discuss ideas? Join our discussions where you can:
- Ask questions in the Q&A section
- Share ideas and proposals
- Show your work with the package
- Stay updated with announcements
-
Issues: Found a bug or want to request a feature? Please open an issue on our GitHub repository.
Contributions are encouraged and appreciated! Here's how you can contribute:
- Fork the repository and create your feature branch from
main - Write clear, documented code and add tests for new functionality
- Ensure all tests pass
- Submit a pull request with a clear description of your changes
For more detailed information about contributing, please check our discussions page.
- Announcements: https://github.com/ReactiveBayes/ExponentialFamilyManifolds.jl/discussions/categories/announcements
- Ideas: https://github.com/ReactiveBayes/ExponentialFamilyManifolds.jl/discussions/categories/announcements
- Q&A: https://github.com/ReactiveBayes/ExponentialFamilyManifolds.jl/discussions/categories/announcements
- Show and Tell: https://github.com/ReactiveBayes/ExponentialFamilyManifolds.jl/discussions/categories/announcements
- Issues: https://github.com/ReactiveBayes/ExponentialFamilyManifolds.jl/issues