
Word Mover's Distance as an exact transport LP (Kamath Eq 8.10)
Source:R/kamath_llm2_native.R
morie_kamath_ch8_wmd.RdMinimises <C, F> subject to the marginals. When F is supplied its cost
is reported and optimal is FALSE; otherwise the exact optimum is solved
and CERTIFIED against its dual before anything is returned.
Examples
C <- matrix(c(0, 3, 2, 1, 1, 4), 2, 3)
morie_kamath_ch8_wmd(c(0.5, 0.5), c(0.2, 0.5, 0.3), C)
#> $estimate
#> [1] 0.8
#>
#> $flow
#> [,1] [,2] [,3]
#> [1,] 0.2 0.0 0.3
#> [2,] 0.0 0.5 0.0
#>
#> $dual_objective
#> [1] 0.8
#>
#> $potentials_u
#> [1] 1 1
#>
#> $potentials_v
#> [1] -1 0 0
#>
#> $optimal
#> [1] TRUE
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "Word Mover's Distance, exact transport LP (Kamath Eq 8.10)"
#>