Skip to content

Gradient of chi-sq #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/distributions/chi_squared.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ end

getgradlogpartition(::NaturalParametersSpace, ::Type{Chisq}) = (η) -> begin
(η1,) = unpack_parameters(Chisq, η)

return SA[digamma(η1 + one(η1)) + logtwo]
end

Expand All @@ -81,6 +82,11 @@ getlogpartition(::MeanParametersSpace, ::Type{Chisq}) = (θ) -> begin
return loggamma(ν / 2) + (ν / 2) * logtwo
end

getgradlogpartition(::MeanParametersSpace, ::Type{Chisq}) = (θ) -> begin
(ν,) = unpack_parameters(Chisq, θ)
return SA[digamma(ν/2)/2 + logtwo/2; ]
end

getfisherinformation(::MeanParametersSpace, ::Type{Chisq}) = (θ) -> begin
(ν,) = unpack_parameters(Chisq, θ)
return SA[trigamma(ν / 2) * (1 / 4);;]
Expand Down