Skip to content
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

Towards Mahony 2024 on-manifold Gaussian products #295

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Rotations = "1"
StaticArrays = "0.15, 1"
Statistics = "1"
TensorCast = "0.2, 0.3, 0.4"
TransformUtils = "0.2.10"
TransformUtils = "0.2.17"
julia = "1.9"

[extensions]
Expand Down
45 changes: 26 additions & 19 deletions src/ApproxManifoldProducts.jl
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
module ApproxManifoldProducts

using Reexport
@reexport using KernelDensityEstimate
import Base: *, isapprox, convert, show, eltype, length

using Logging
using StaticArrays
using LinearAlgebra
import LinearAlgebra: rotate!, det

using TensorCast
using DocStringExtensions
using Distributions
using Random
import Random: rand

using Statistics
import Statistics: mean, std, cov, var, entropy

import TransformUtils as TUs
import Rotations as _Rot
using CoordinateTransformations

import ManifoldsBase
import ManifoldsBase: AbstractManifold, distance
using RecursiveArrayTools: ArrayPartition
export ArrayPartition

import ManifoldsBase
import ManifoldsBase: AbstractManifold, distance
using Manifolds

using DocStringExtensions

using NLsolve
import Optim
using CoordinateTransformations
using Requires
using LinearAlgebra
using TensorCast
using StaticArrays
using Logging
using Statistics
using Distributions

import Random: rand
import TransformUtils as TUs
import TransformUtils: skew

import Base: *, isapprox, convert, show, eltype, length
import LinearAlgebra: rotate!, det
import Statistics: mean, std, cov, var, entropy
using Reexport
@reexport using KernelDensityEstimate
import KernelDensityEstimate: getPoints, getBW, evalAvgLogL, entropy, evaluate


# FIXME ON FIRE OBSOLETE REMOVE
using Requires

const MB = ManifoldsBase
const CTs = CoordinateTransformations
const AMP = ApproxManifoldProducts
Expand All @@ -52,6 +58,7 @@ include("entities/KernelEval.jl")
include("entities/ManellicTree.jl") # experimental
include("entities/ManifoldKernelDensity.jl")

include("services/ManifoldsOverloads.jl")
include("CommonUtils.jl")
include("services/ManellicTree.jl")

Expand Down
12 changes: 9 additions & 3 deletions src/CommonUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ end
# end




"""
$SIGNATURES

Expand Down Expand Up @@ -132,8 +134,11 @@ function calcProductGaussians(
#
# calc sum of covariances
Λ = zeros(MMatrix{dim,dim})
# FIXME first transport (push forward) covariances to common coordinates
# see [Ge, van Goor, Mahony, 2024]
Λ .= sum(Λ_)

# naive mean
# Tangent space reference around the evenly weighted mean of incoming points
u0 = mean(M, μ_)

Expand All @@ -144,7 +149,7 @@ function calcProductGaussians(
Δuvee = vee(M, u0, log(M, u0, u))
ΛΔμ += s*Δuvee
end

Λ
# calculate the delta mean
Δμ = Λ \ ΛΔμ

Expand Down Expand Up @@ -179,8 +184,9 @@ calcProductGaussians(
EXPERIMENTAL: On-manifold product of Gaussians.

DevNotes
- CHECK make sure this product is properly on manifold, Manifolds.jl likely already has solutions:
- https://juliamanifolds.github.io/Manifolds.jl/stable/features/distributions.html
- FIXME do product of concentrated Gaussians on Lie group (approximation):
- See Section 3.2 and 4 of [Ge, van Goor, Mahony: A Geometric Perspective on using Gaussian Distributions on Lie Groups, 2024].
- Also see upstream utils, https://juliamanifolds.github.io/Manifolds.jl/stable/features/distributions.html
- FIXME is parallel transport needed when multiplying with covariances from difffent tangent spaces?
"""
function calcProductGaussians(
Expand Down
Loading
Loading