WaBarycenter: Regularized Wasserstein Barycenters

Description Usage Arguments Value Author(s) References Examples

Description

WaBarycenter takes in a list of matrices representing joint measures on the row and column space and outputs the corresponding Barycenter. The list has to consist of matrices having all the same dimensions, for instance, each matrix represents the normalized weights of the corresponding pixels of images.

Usage

1
WaBarycenter(images, maxIter = 10, lambda = FALSE, costm = FALSE)

Arguments

images

A list of matrices satisfying the prerequisites described above.

maxIter

Maximum number of iterations.

lambda

Non-negative regularization parameter (for large lambda the regularized Barycenter is close to its true counterpart). If FALSE the algorithm uses a lambda depending on costm.

costm

A matrix of pairwise distances between the locations. If FALSE the algorithm uses the usual euclidean distance matrix on a [0,1]x[0,1] equidistant pixel grid.

Value

The Barycenter of the matrices, represented by a n x m matrix.

Given the MNIST dataset, a Barycenter of the digit three is shown below. The Barycenter is based on 4351 images each represented by a 28 x 28 pixel grid, respectively. The values for lambda and maxIter were set by default. The dataset is also available in this package (c.f. three).

test

Author(s)

Marcel Klatt

References

Cuturi, M.: Fast Computation of Wasserstein Barycenters, Proceedings of the International Conference on Machine Learning, Beijing, China, 2014

Examples

1
2
3
4
#Computation of a Barycenter based on five images representing the digit eight, respectively.
WaBarycenter(eight,lambda=10)
#For a more reasonable but longer computation!
## Not run: WaBarycenter(eight)

Example output

Loading required package: Rcpp
   user  system elapsed 
  1.717   0.111   1.856 
              [,1]         [,2]         [,3]         [,4]         [,5]
 [1,] 8.855358e-05 1.060048e-04 1.256737e-04 1.460480e-04 0.0001653194
 [2,] 1.202892e-04 1.490866e-04 1.809473e-04 2.132977e-04 0.0002432104
 [3,] 1.668672e-04 2.117140e-04 2.608292e-04 3.101688e-04 0.0003550326
 [4,] 2.306307e-04 2.975316e-04 3.710263e-04 4.447984e-04 0.0005110112
 [5,] 3.126949e-04 4.095071e-04 5.175997e-04 6.270200e-04 0.0007240267
 [6,] 4.121965e-04 5.484372e-04 7.049394e-04 8.665656e-04 0.0010074614
 [7,] 5.248879e-04 7.098135e-04 9.301209e-04 1.165741e-03 0.0013651253
 [8,] 6.420595e-04 8.803838e-04 1.173715e-03 1.497736e-03 0.0017539356
 [9,] 7.515420e-04 1.039347e-03 1.397237e-03 1.782432e-03 0.0020448488
[10,] 8.410897e-04 1.166871e-03 1.570278e-03 1.983520e-03 0.0022328751
[11,] 9.016635e-04 1.250344e-03 1.679376e-03 2.115455e-03 0.0023746155
[12,] 9.287979e-04 1.284975e-03 1.722344e-03 2.174086e-03 0.0024875248
[13,] 9.223865e-04 1.271992e-03 1.700935e-03 2.161275e-03 0.0025373656
[14,] 8.857166e-04 1.217287e-03 1.625749e-03 2.073894e-03 0.0024959808
[15,] 8.242515e-04 1.128679e-03 1.503913e-03 1.931682e-03 0.0023559298
[16,] 7.447406e-04 1.016236e-03 1.351579e-03 1.740718e-03 0.0021415056
[17,] 6.541300e-04 8.895851e-04 1.180691e-03 1.521008e-03 0.0018729897
[18,] 5.588461e-04 7.572303e-04 1.001780e-03 1.286435e-03 0.0015764680
[19,] 4.645497e-04 6.269074e-04 8.261976e-04 1.056999e-03 0.0012895384
[20,] 3.758862e-04 5.049088e-04 6.627859e-04 8.458027e-04 0.0010300826
[21,] 2.963336e-04 3.956879e-04 5.168144e-04 6.574472e-04 0.0008026105
[22,] 2.282297e-04 3.021971e-04 3.919366e-04 4.953502e-04 0.0006073001
[23,] 1.727905e-04 2.259382e-04 2.904782e-04 3.650209e-04 0.0004467845
[24,] 1.300924e-04 1.667879e-04 2.118020e-04 2.642053e-04 0.0003221751
[25,] 9.911791e-05 1.233247e-04 1.535504e-04 1.893349e-04 0.0002296426
[26,] 7.789160e-05 9.318981e-05 1.126106e-04 1.361409e-04 0.0001633573
[27,] 6.386466e-05 7.333887e-05 8.536897e-05 1.001976e-04 0.0001178264
[28,] 5.456979e-05 6.055542e-05 6.796570e-05 7.706301e-05 0.0000880300
              [,6]         [,7]         [,8]         [,9]        [,10]
 [1,] 0.0001817647 0.0001940847 0.0002016128 0.0002043525 0.0002028512
 [2,] 0.0002679947 0.0002857530 0.0002957123 0.0002982321 0.0002945203
 [3,] 0.0003911284 0.0004156258 0.0004277284 0.0004285887 0.0004206733
 [4,] 0.0005625381 0.0005950728 0.0006080712 0.0006043759 0.0005888127
 [5,] 0.0007964579 0.0008378366 0.0008486135 0.0008350743 0.0008063357
 [6,] 0.0011071756 0.0011567617 0.0011593251 0.0011276202 0.0010781912
 [7,] 0.0014958560 0.0015505960 0.0015369907 0.0014784473 0.0014027450
 [8,] 0.0018935411 0.0019389994 0.0019167546 0.0018557547 0.0017661508
 [9,] 0.0021682790 0.0022260862 0.0022354865 0.0022055998 0.0021341047
[10,] 0.0023270835 0.0023912721 0.0024477964 0.0024795783 0.0024656594
[11,] 0.0024585647 0.0025081318 0.0025703776 0.0026582050 0.0027277377
[12,] 0.0025941774 0.0026329785 0.0026880365 0.0027829631 0.0029133808
[13,] 0.0027169760 0.0027690572 0.0028200179 0.0029089972 0.0030504479
[14,] 0.0027781003 0.0028921638 0.0029442548 0.0030215854 0.0031573957
[15,] 0.0027127469 0.0029219645 0.0030233869 0.0030983380 0.0032204641
[16,] 0.0024973000 0.0027715785 0.0029464799 0.0030607422 0.0031777145
[17,] 0.0021921543 0.0024613308 0.0026700629 0.0028301551 0.0029724212
[18,] 0.0018458447 0.0020778520 0.0022704771 0.0024444230 0.0026006123
[19,] 0.0015083181 0.0017008667 0.0018678514 0.0020226832 0.0021705421
[20,] 0.0012057961 0.0013652866 0.0015068964 0.0016422323 0.0017718037
[21,] 0.0009428970 0.0010736325 0.0011942154 0.0013079649 0.0014177840
[22,] 0.0007186391 0.0008235343 0.0009225898 0.0010174768 0.0011099824
[23,] 0.0005308604 0.0006125197 0.0006917942 0.0007699879 0.0008463969
[24,] 0.0003831323 0.0004448280 0.0005066297 0.0005689259 0.0006324685
[25,] 0.0002731228 0.0003186197 0.0003656385 0.0004143373 0.0004653867
[26,] 0.0001936099 0.0002263016 0.0002611246 0.0002981342 0.0003377100
[27,] 0.0001380712 0.0001606962 0.0001855512 0.0002126423 0.0002421234
[28,] 0.0001009521 0.0001158461 0.0001327129 0.0001515766 0.0001724843
             [,11]        [,12]        [,13]        [,14]        [,15]
 [1,] 0.0001979741 0.0001906571 0.0001817085 0.0001717019 0.0001609690
 [2,] 0.0002861898 0.0002748194 0.0002616338 0.0002473530 0.0002322222
 [3,] 0.0004068967 0.0003898628 0.0003713777 0.0003522506 0.0003323828
 [4,] 0.0005664950 0.0005415924 0.0005166974 0.0004925971 0.0004683653
 [5,] 0.0007709763 0.0007353371 0.0007029859 0.0006745655 0.0006476961
 [6,] 0.0010241942 0.0009745610 0.0009338997 0.0009023799 0.0008761396
 [7,] 0.0013256035 0.0012595414 0.0012104036 0.0011773490 0.0011514258
 [8,] 0.0016682027 0.0015866839 0.0015309081 0.0014987318 0.0014745265
 [9,] 0.0020372219 0.0019484790 0.0018919127 0.0018654677 0.0018465414
[10,] 0.0024056104 0.0023347602 0.0022880186 0.0022680598 0.0022555739
[11,] 0.0027510413 0.0027297633 0.0027045524 0.0026944675 0.0026831773
[12,] 0.0030329483 0.0031028007 0.0031196410 0.0031128465 0.0031086475
[13,] 0.0032344734 0.0033897836 0.0034738000 0.0034873319 0.0034942823
[14,] 0.0033449518 0.0035514820 0.0037046374 0.0037623227 0.0037545143
[15,] 0.0033936198 0.0035947789 0.0037769831 0.0038606147 0.0038566161
[16,] 0.0033364227 0.0035229643 0.0036890364 0.0037885875 0.0038095676
[17,] 0.0031256509 0.0032819632 0.0034282511 0.0035482119 0.0036271160
[18,] 0.0027493772 0.0028906598 0.0030300040 0.0031719477 0.0033113126
[19,] 0.0023104533 0.0024459678 0.0025902696 0.0027506564 0.0029286584
[20,] 0.0018965041 0.0020238871 0.0021638703 0.0023284663 0.0025235104
[21,] 0.0015268046 0.0016402968 0.0017684999 0.0019258605 0.0021174681
[22,] 0.0012026704 0.0013011269 0.0014174644 0.0015585172 0.0017276267
[23,] 0.0009253554 0.0010126060 0.0011136556 0.0012330877 0.0013725690
[24,] 0.0006995257 0.0007734355 0.0008574050 0.0009536456 0.0010622777
[25,] 0.0005200616 0.0005800442 0.0006468421 0.0007211205 0.0008019308
[26,] 0.0003804867 0.0004271795 0.0004782529 0.0005334855 0.0005914676
[27,] 0.0002742280 0.0003091334 0.0003467520 0.0003864648 0.0004268284
[28,] 0.0001954627 0.0002204284 0.0002470598 0.0002746443 0.0003019289
             [,16]        [,17]        [,18]        [,19]        [,20]
 [1,] 0.0001496726 0.0001379140 0.0001258312 0.0001136567 0.0001017237
 [2,] 0.0002161896 0.0001991445 0.0001811108 0.0001623556 0.0001434061
 [3,] 0.0003111538 0.0002879491 0.0002625217 0.0002351397 0.0002066269
 [4,] 0.0004420738 0.0004120656 0.0003776465 0.0003390262 0.0002975970
 [5,] 0.0006175841 0.0005804995 0.0005355352 0.0004823550 0.0004233817
 [6,] 0.0008434459 0.0007993172 0.0007428832 0.0006729982 0.0005912917
 [7,] 0.0011156606 0.0010648737 0.0009965193 0.0009101180 0.0008070301
 [8,] 0.0014395825 0.0013829372 0.0013014512 0.0011967275 0.0010711471
 [9,] 0.0018158571 0.0017554356 0.0016581614 0.0015338956 0.0013836376
[10,] 0.0022257461 0.0021631274 0.0020619089 0.0019231546 0.0017458783
[11,] 0.0026590436 0.0026007269 0.0024999481 0.0023541073 0.0021524283
[12,] 0.0030940734 0.0030370685 0.0029423079 0.0027960721 0.0025825465
[13,] 0.0034712581 0.0034006097 0.0033035732 0.0031775877 0.0029789791
[14,] 0.0037099481 0.0036124771 0.0035054340 0.0033974616 0.0032365410
[15,] 0.0037805393 0.0036778571 0.0035677101 0.0034628875 0.0033416823
[16,] 0.0037519454 0.0036493218 0.0035402139 0.0034442015 0.0033506169
[17,] 0.0036362187 0.0035705406 0.0034739534 0.0033731947 0.0032770288
[18,] 0.0034177180 0.0034400258 0.0033756747 0.0032707313 0.0031600358
[19,] 0.0031080659 0.0032233604 0.0032268886 0.0031412902 0.0030289598
[20,] 0.0027310418 0.0029143990 0.0029985867 0.0029655967 0.0028716319
[21,] 0.0023271281 0.0025335019 0.0026794713 0.0027262271 0.0026631552
[22,] 0.0019196875 0.0021092808 0.0022745003 0.0023706060 0.0023557386
[23,] 0.0015288411 0.0016886891 0.0018277096 0.0019177281 0.0019266365
[24,] 0.0011797556 0.0012972112 0.0013991233 0.0014580071 0.0014560501
[25,] 0.0008857680 0.0009655520 0.0010296524 0.0010630400 0.0010528154
[26,] 0.0006490590 0.0007009228 0.0007394817 0.0007561214 0.0007436770
[27,] 0.0004653117 0.0004981714 0.0005206835 0.0005279685 0.0005163392
[28,] 0.0003270198 0.0003474080 0.0003602151 0.0003627209 0.0003530977
             [,21]        [,22]        [,23]        [,24]        [,25]
 [1,] 9.041997e-05 8.010965e-05 7.105494e-05 6.336546e-05 5.699294e-05
 [2,] 1.249660e-04 1.077705e-04 9.244652e-05 7.940184e-05 6.875500e-05
 [3,] 1.781748e-04 1.510322e-04 1.263096e-04 1.048654e-04 8.718840e-05
 [4,] 2.554868e-04 2.146977e-04 1.769144e-04 1.435080e-04 1.154281e-04
 [5,] 3.628129e-04 3.036253e-04 2.482511e-04 1.987061e-04 1.564138e-04
 [6,] 5.067182e-04 4.230792e-04 3.442424e-04 2.733680e-04 2.124461e-04
 [7,] 6.941723e-04 5.784463e-04 4.687467e-04 3.700225e-04 2.851586e-04
 [8,] 9.283483e-04 7.741934e-04 6.249165e-04 4.905711e-04 3.754843e-04
 [9,] 1.206557e-03 1.011560e-03 8.140884e-04 6.357185e-04 4.833449e-04
[10,] 1.529861e-03 1.286401e-03 1.035878e-03 8.042398e-04 6.070331e-04
[11,] 1.895565e-03 1.598218e-03 1.286586e-03 9.911211e-04 7.423402e-04
[12,] 2.289985e-03 1.932382e-03 1.549143e-03 1.185788e-03 8.821593e-04
[13,] 2.665390e-03 2.253707e-03 1.803000e-03 1.374665e-03 1.017196e-03
[14,] 2.950753e-03 2.519832e-03 2.030868e-03 1.542099e-03 1.136781e-03
[15,] 3.105900e-03 2.703921e-03 2.194404e-03 1.670144e-03 1.230349e-03
[16,] 3.163336e-03 2.802741e-03 2.288830e-03 1.749222e-03 1.290464e-03
[17,] 3.124980e-03 2.813609e-03 2.315965e-03 1.777737e-03 1.313957e-03
[18,] 3.019262e-03 2.750994e-03 2.285289e-03 1.759061e-03 1.300721e-03
[19,] 2.885970e-03 2.641359e-03 2.209601e-03 1.695217e-03 1.251150e-03
[20,] 2.724351e-03 2.476924e-03 2.068070e-03 1.581050e-03 1.165352e-03
[21,] 2.502784e-03 2.236521e-03 1.850619e-03 1.417582e-03 1.046881e-03
[22,] 2.214032e-03 1.949175e-03 1.590359e-03 1.219890e-03 9.048763e-04
[23,] 1.817638e-03 1.588787e-03 1.302246e-03 1.004786e-03 7.512971e-04
[24,] 1.372482e-03 1.213501e-03 1.007491e-03 7.900757e-04 5.988077e-04
[25,] 9.911363e-04 8.824361e-04 7.432256e-04 5.955776e-04 4.592523e-04
[26,] 6.990873e-04 6.257772e-04 5.333898e-04 4.345780e-04 3.407537e-04
[27,] 4.847320e-04 4.356236e-04 3.747109e-04 3.093029e-04 2.462503e-04
[28,] 3.311175e-04 2.985130e-04 2.587349e-04 2.161351e-04 1.749345e-04
             [,26]        [,27]        [,28]
 [1,] 5.177216e-05 4.748707e-05 4.392990e-05
 [2,] 6.033711e-05 5.377985e-05 4.865018e-05
 [3,] 7.330889e-05 6.281631e-05 5.501978e-05
 [4,] 9.307093e-05 7.619342e-05 6.397340e-05
 [5,] 1.221209e-04 9.583541e-05 7.678648e-05
 [6,] 1.624527e-04 1.234896e-04 9.482897e-05
 [7,] 2.152656e-04 1.602493e-04 1.191455e-04
 [8,] 2.809406e-04 2.063628e-04 1.501134e-04
 [9,] 3.589519e-04 2.612196e-04 1.873258e-04
[10,] 4.475804e-04 3.233105e-04 2.296218e-04
[11,] 5.435568e-04 3.901462e-04 2.751511e-04
[12,] 6.419515e-04 4.582645e-04 3.214630e-04
[13,] 7.364871e-04 5.234262e-04 3.656648e-04
[14,] 8.201559e-04 5.810113e-04 4.046736e-04
[15,] 8.862066e-04 6.265927e-04 4.355505e-04
[16,] 9.293955e-04 6.565665e-04 4.558524e-04
[17,] 9.466948e-04 6.685791e-04 4.639017e-04
[18,] 9.370513e-04 6.615969e-04 4.589150e-04
[19,] 9.006503e-04 6.357738e-04 4.410296e-04
[20,] 8.388413e-04 5.924690e-04 4.113265e-04
[21,] 7.551384e-04 5.344810e-04 3.718545e-04
[22,] 6.557351e-04 4.660759e-04 3.255392e-04
[23,] 5.485980e-04 3.925216e-04 2.758899e-04
[24,] 4.421221e-04 3.193195e-04 2.265561e-04
[25,] 3.438202e-04 2.514005e-04 1.808533e-04
[26,] 2.590554e-04 1.924661e-04 1.413522e-04
[27,] 1.904760e-04 1.446551e-04 1.095777e-04
[28,] 1.384131e-04 1.085224e-04 8.582502e-05

Barycenter documentation built on May 2, 2019, 6:47 a.m.