Add natural gamma manifold#26
Open
Nimrais wants to merge 12 commits into
Open
Conversation
Nimrais
marked this pull request as draft
January 22, 2025 18:22
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
+ Coverage 96.69% 97.28% +0.58%
==========================================
Files 25 28 +3
Lines 333 405 +72
==========================================
+ Hits 322 394 +72
Misses 11 11 ☔ View full report in Codecov by Sentry. |
Contributor
|
A more generic implementation of Christoffel symbol. function christoffel(::Type{D}, ::NaturalParametersSpace, η) where D
# Pre-compute values used multiple times
ef = ExponentialFamilyDistribution(D, η, nothing)
G = fisherinformation(ef)
G⁻¹ = cholinv(G)
dG = partial_metric(D, NaturalParametersSpace(), η)
T = eltype(G) # Get the element type from G
# Pre-allocate output array
rep_size = sum(representation_size(get_natural_manifold(D, size(η))))
Γ = zeros(T, rep_size, rep_size, rep_size)
# Pre-compute the sum of dG terms
dG_sum = similar(dG)
@tensor begin
dG_sum[ℓ,j,i] = dG[ℓ,j,i] + dG[ℓ,i,j] - dG[i,j,ℓ]
end
# Use tensor operations with pre-computed sum
@tensor begin
Γ[k,i,j] = T(0.5) * G⁻¹[k,ℓ] * dG_sum[ℓ,j,i]
end
return Γ
end |
Contributor
|
Is there an ETA on this one? |
Nimrais
marked this pull request as ready for review
February 7, 2025 12:02
Member
Author
|
@ismailsenoz I think there are nuances, but more or less all things are addressed. I don't want to change the partial code for now, I will think about how to do it properly when I address a review for Juliacon, implementing all ideas from this PR but generically for all exponential families. |
ismailsenoz
reviewed
Feb 13, 2025
ismailsenoz
left a comment
Contributor
There was a problem hiding this comment.
ForwardDiff instead of symbolic partial derivatives.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.