Skip to contents

Fits a monotone softplus-sigmoid basis to the known 1-D optimal coupling \(T = F_{target}^{-1}\circ F_{source}\) by least squares. Monotone by construction (softplus weights are non-negative). This is a monotone fit to the closed-form coupling, not a solve of the Kantorovich problem.

Usage

morie_neural_kantorovich_map(
  source,
  target,
  n_iter = 400L,
  lr = 0.05,
  n_basis = 12L,
  seed = 0L
)

Arguments

source, target

samples.

n_iter, lr, n_basis

fit controls.

seed

RNG seed.

Value

list with map_at_source, monotone, rmse.

References

Makkuva, A., Taghvaei, A., Oh, S. and Lee, J. (2020). Optimal transport mapping via input convex neural networks. In ICML. Brenier, Y. (1991). Polar factorization and monotone rearrangement of vector-valued functions. Communications on Pure and Applied Mathematics, 44(4), 375-417.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_neural_kantorovich_map(V, V)
#> $map_at_source
#> [1] 1.728938 2.377740 3.137907 3.987659 4.892472 5.808326 6.687427 7.486046
#> 
#> $exact_map
#> [1] 1.4375 2.3125 3.1875 4.0625 4.9375 5.8125 6.6875 7.5625
#> 
#> $monotone
#> [1] TRUE
#> 
#> $rmse_vs_exact
#> [1] 0.1146424
#> 
#> $w2
#> [1] 0.13792
#> 
#> $w2_exact
#> [1] 0.08203125
#> 
#> $loss_history
#>   [1] 18.46997242 12.53941814  8.81381467  6.38047680  4.74693426  3.62800874
#>   [7]  2.84974501  2.30182410  1.91218643  1.63268021  1.43055368  1.28321643
#>  [13]  1.17491289  1.09455630  1.03428932  0.98851107  0.95321048  0.92550415
#>  [19]  0.90331304  0.88513442  0.86988002  0.85676055  0.84520291  0.83479063
#>  [25]  0.82522090  0.81627351  0.80778829  0.79964876  0.79177026  0.78409128
#>  [31]  0.77656720  0.76916566  0.76186324  0.75464304  0.74749285  0.74040394
#>  [37]  0.73337003  0.72638669  0.71945076  0.71256005  0.70571305  0.69890871
#>  [43]  0.69214637  0.68542560  0.67874615  0.67210789  0.66551079  0.65895488
#>  [49]  0.65244020  0.64596685  0.63953494  0.63314457  0.62679586  0.62048892
#>  [55]  0.61422387  0.60800082  0.60181986  0.59568110  0.58958464  0.58353054
#>  [61]  0.57751889  0.57154975  0.56562320  0.55973928  0.55389804  0.54809953
#>  [67]  0.54234377  0.53663079  0.53096062  0.52533325  0.51974871  0.51420699
#>  [73]  0.50870809  0.50325198  0.49783865  0.49246807  0.48714022  0.48185504
#>  [79]  0.47661251  0.47141256  0.46625515  0.46114020  0.45606766  0.45103744
#>  [85]  0.44604948  0.44110368  0.43619996  0.43133822  0.42651836  0.42174029
#>  [91]  0.41700388  0.41230903  0.40765561  0.40304351  0.39847259  0.39394273
#>  [97]  0.38945378  0.38500560  0.38059805  0.37623098  0.37190424  0.36761767
#> [103]  0.36337110  0.35916438  0.35499733  0.35086978  0.34678156  0.34273249
#> [109]  0.33872239  0.33475107  0.33081835  0.32692402  0.32306791  0.31924981
#> [115]  0.31546952  0.31172685  0.30802158  0.30435351  0.30072243  0.29712814
#> [121]  0.29357040  0.29004902  0.28656377  0.28311444  0.27970080  0.27632262
#> [127]  0.27297969  0.26967177  0.26639864  0.26316008  0.25995584  0.25678569
#> [133]  0.25364941  0.25054676  0.24747750  0.24444140  0.24143821  0.23846771
#> [139]  0.23552964  0.23262377  0.22974987  0.22690768  0.22409697  0.22131750
#> [145]  0.21856901  0.21585128  0.21316405  0.21050708  0.20788013  0.20528295
#> [151]  0.20271530  0.20017694  0.19766762  0.19518710  0.19273513  0.19031147
#> [157]  0.18791588  0.18554811  0.18320792  0.18089507  0.17860931  0.17635041
#> [163]  0.17411812  0.17191221  0.16973243  0.16757854  0.16545030  0.16334749
#> [169]  0.16126985  0.15921715  0.15718916  0.15518564  0.15320636  0.15125108
#> [175]  0.14931958  0.14741161  0.14552696  0.14366539  0.14182666  0.14001057
#> [181]  0.13821687  0.13644534  0.13469577  0.13296792  0.13126158  0.12957652
#> [187]  0.12791252  0.12626937  0.12464685  0.12304475  0.12146284  0.11990093
#> [193]  0.11835878  0.11683620  0.11533298  0.11384891  0.11238377  0.11093738
#> [199]  0.10950951  0.10809998  0.10670858  0.10533511  0.10397937  0.10264116
#> [205]  0.10132030  0.10001658  0.09872982  0.09745983  0.09620641  0.09496937
#> [211]  0.09374854  0.09254373  0.09135474  0.09018141  0.08902355  0.08788098
#> [217]  0.08675353  0.08564101  0.08454326  0.08346010  0.08239136  0.08133687
#> [223]  0.08029646  0.07926996  0.07825721  0.07725805  0.07627232  0.07529984
#> [229]  0.07434046  0.07339403  0.07246039  0.07153938  0.07063085  0.06973464
#> [235]  0.06885061  0.06797861  0.06711849  0.06627010  0.06543330  0.06460794
#> [241]  0.06379388  0.06299099  0.06219912  0.06141813  0.06064789  0.05988827
#> [247]  0.05913912  0.05840033  0.05767175  0.05695325  0.05624472  0.05554602
#> [253]  0.05485703  0.05417761  0.05350766  0.05284705  0.05219566  0.05155337
#> [259]  0.05092006  0.05029561  0.04967992  0.04907287  0.04847434  0.04788422
#> [265]  0.04730241  0.04672880  0.04616327  0.04560572  0.04505605  0.04451416
#> [271]  0.04397993  0.04345328  0.04293409  0.04242227  0.04191773  0.04142035
#> [277]  0.04093006  0.04044675  0.03997034  0.03950072  0.03903780  0.03858151
#> [283]  0.03813174  0.03768842  0.03725144  0.03682074  0.03639621  0.03597778
#> [289]  0.03556537  0.03515890  0.03475827  0.03436342  0.03397426  0.03359072
#> [295]  0.03321271  0.03284017  0.03247302  0.03211118  0.03175458  0.03140315
#> [301]  0.03105682  0.03071551  0.03037916  0.03004770  0.02972105  0.02939916
#> [307]  0.02908196  0.02876938  0.02846136  0.02815783  0.02785873  0.02756400
#> [313]  0.02727357  0.02698740  0.02670541  0.02642755  0.02615376  0.02588398
#> [319]  0.02561816  0.02535624  0.02509817  0.02484389  0.02459334  0.02434648
#> [325]  0.02410325  0.02386360  0.02362748  0.02339484  0.02316563  0.02293980
#> [331]  0.02271730  0.02249809  0.02228211  0.02206932  0.02185969  0.02165315
#> [337]  0.02144967  0.02124919  0.02105169  0.02085712  0.02066543  0.02047658
#> [343]  0.02029053  0.02010724  0.01992667  0.01974879  0.01957354  0.01940091
#> [349]  0.01923083  0.01906329  0.01889824  0.01873565  0.01857547  0.01841768
#> [355]  0.01826225  0.01810912  0.01795828  0.01780969  0.01766332  0.01751913
#> [361]  0.01737709  0.01723717  0.01709934  0.01696357  0.01682983  0.01669809
#> [367]  0.01656831  0.01644048  0.01631455  0.01619051  0.01606833  0.01594797
#> [373]  0.01582942  0.01571264  0.01559761  0.01548430  0.01537269  0.01526275
#> [379]  0.01515446  0.01504779  0.01494272  0.01483922  0.01473728  0.01463686
#> [385]  0.01453796  0.01444053  0.01434457  0.01425004  0.01415693  0.01406522
#> [391]  0.01397489  0.01388591  0.01379827  0.01371194  0.01362691  0.01354316
#> [397]  0.01346066  0.01337940  0.01329936  0.01322053
#> 
#> $converged
#> [1] FALSE
#> 
#> $n_source
#> [1] 8
#> 
#> $n_target
#> [1] 8
#>