Frechet
NonArchimedeanMachineLearning.frechet_mean — Method
frechet_mean(X::Vector{Vector{PadicFieldElem}})Compute the Fréchet mean of a collection of p-adic vectors.
Computes the Fréchet mean with respect to the $\ell^1$-metric on $\mathcal{B}^n$ by minimizing $\sum_{i} d(x, x_i)$ coordinatewise.
Arguments
X::Vector{Vector{PadicFieldElem}}: Collection of p-adic vectors
Returns
Vector{PadicFieldElem}: The Fréchet mean vector
Algorithm
For each coordinate, selects the sample point that minimizes the sum of distances to all other points in that coordinate.
NonArchimedeanMachineLearning.frechet_mean — Method
frechet_mean(X::Array{ValuationPolydisc{S, T, N}, 1}, prec) where {S,T,N}Compute the Fréchet mean of a collection of polydiscs.
Uses greedy descent optimization to minimize the sum of distances to all polydiscs. Starts from the join of all polydiscs and refines for a specified number of steps.
Arguments
X::Array{ValuationPolydisc{S, T, N}, 1}: Collection of polydiscsprec: Number of optimization steps (precision/iterations)
Returns
ValuationPolydisc{S, T, N}: The approximate Fréchet mean polydisc
Implementation Notes
Uses a workaround by constructing a dummy model to leverage the optimization library. This should be refactored for a cleaner implementation.