Skip to contents

A linear encoder/decoder trained by gradient descent to reconstruct X from X + noise. Final evaluation is delegated to morie_geron_denoising_autoencoder (the grdae core); this function is the training loop, distinct from that core by the _train suffix.

Usage

morie_geron_denoising_autoencoder_train(
  X,
  noise_std = 0.3,
  epochs = 300,
  lr = 0.05,
  hidden = NULL,
  seed = 0
)

Arguments

X

Clean data (m, d).

noise_std

Corruption sd (>0).

epochs, lr

Training config.

hidden

Code width (default d).

seed

LCG seed.

Value

List with loss_history, final_loss, encoder, decoder, reconstruction, denoising_gain, snr_db, passthrough_loss.

Examples

morie_geron_denoising_autoencoder_train(X = c(2.5, 1.0, 3.5, 4.0, 2.0, 5.5, 3.0, 6.5))
#> $loss_history
#>   [1]  1.4780644  3.5737754 11.9183320  2.0794254  4.1282234 12.8827929
#>   [7]  4.7907040  3.6959625 12.0512873  2.6439263  4.4265883 13.3621262
#>  [13]  6.4503857  2.0919637  7.7804044  0.8600462  3.2250103  4.4864455
#>  [19] 13.4524990  6.7899470  1.7512016  6.6251175  1.9154290  7.1924882
#>  [25]  1.3649656  5.2153751  3.3214913 11.2272476  1.2113306  3.0039939
#>  [31] 10.4463866  0.4321337  1.1715885  4.4716357  3.9398212 12.5318940
#>  [37]  3.8071121  4.3278676 13.2075031  5.8937927  2.6591688  9.5121422
#>  [43]  0.1208907  0.1216951  0.1249167  0.1374433  0.1889056  0.3751999
#>  [49]  1.1927252  2.9705763 10.3597793  0.3766999  1.0019730  3.7999249
#>  [55]  4.3309650 13.2124598  5.9111649  2.6415726  9.4620581  0.1207449
#>  [61]  0.1211212  0.1226040  0.1285625  0.1515532  0.2470329  0.5788097
#>  [67]  2.0561629  4.0918019 12.8094759  4.5981467  3.8461279 12.3523690
#>  [73]  3.3427638  4.4704381 13.4285777  6.6990427  1.8414436  6.9393034
#>  [79]  1.6050589  6.1039485  2.4453761  8.8877932  0.2227005  0.5449659
#>  [85]  1.4982332  5.7134835  2.8405243 10.0146980  0.2119763  0.4571964
#>  [91]  1.5414689  3.5251033 11.6882048  1.9295677  3.9779909 12.6031901
#>  [97]  4.0017136  4.2343615 13.0546366  5.3731401  3.1732852 10.8721886
#> [103]  0.7924045  2.1361783  7.9240487  0.7511055  2.7764959  4.4620091
#> [109] 13.4159086  6.6511993  1.8892701  7.1034258  1.4481806  5.5278196
#> [115]  3.0239552 10.4977175  0.4677579  1.2773363  4.8813598  3.6179401
#> [121] 11.8881173  2.3061841  4.2715388 13.1161652  5.5791974  2.9736045
#> [127] 10.3676622  0.3815050  1.0169274  3.8598397  4.3043512 13.1696469
#> [133]  5.7621354  2.7918517  9.8822620  0.1715431  0.3123492  0.9252081
#> [139]  2.4384214  8.8669043  0.2297613  0.5747897  1.5806405  6.0153967
#> [145]  2.5356695  9.1556877  0.1522943  0.2500997  0.5892889  2.1003058
#> [151]  4.1278006 12.8727680  4.7912541  3.6931060 12.0452917  2.6312744
#> [157]  4.4224673 13.3558043  6.4270525  2.1156717  7.8576072  0.8006847
#> [163]  2.9813479  4.4907188 13.4588544  6.8142235  1.7272564  6.5407666
#> [169]  2.0003974  7.4783230  1.1088326  4.2251475  4.1055798 12.8338107
#> [175]  4.6718254  3.7891071 12.2399589  3.0703728  4.4938244 13.4634650
#> [181]  6.8318685  1.7098962  6.4793559  2.0625621  7.6840821  0.9366252
#> [187]  3.5366030  4.4256808 13.3607302  6.4452475  2.0971811  7.7974300
#> [193]  0.8467973  3.1707841  4.4908354 13.4590277  6.8148863  1.7266036
#> [199]  6.5384614  2.0027267  7.4860840  1.1021381  4.1987097  4.1219357
#> [205] 12.8625204  4.7596621  3.7189148 12.0982944  2.7467869  4.4552509
#> [211] 13.4057145  6.6128538  1.9277485  7.2342591  1.3264527  5.0692006
#> [217]  3.4544115 11.5316759  1.6626742  3.6841292 12.0267410  2.5915519
#> [223]  4.4087500 13.3346947  6.3494329  2.1947033  8.1119505  0.6189335
#> [229]  2.2249707  4.2195014 13.0297653  5.2911765  3.2508501 11.0600700
#> [235]  1.0000939  2.5974050  9.3353137  0.1271542  0.1469354  0.2213443
#> [241]  0.5392409  1.4822315  5.6543138  2.8994072 10.1725219  0.2764121
#> [247]  0.6781964  2.4731787  4.3602200 13.2589381  6.0755724  2.4743332
#> [253]  8.9743761  0.1958064  0.4316971  1.1702769  4.4665094  3.9435004
#> [259] 12.5388127  3.8257403  4.3197182 13.1944291  5.8481198  2.7053403
#> [265]  9.6424474  0.1285948  0.1516777  0.2475480  0.5805715  2.0635872
#> [271]  4.0979878 12.8204186  4.6311903  3.8207708 12.3026755  3.2206236
#> [277]  4.4868716 13.4531334  6.7923677  1.7488108  6.6167141  1.9238694
#> [283]  7.2211183  1.3385317  5.1151521  3.4131236 11.4385288  1.5152183
#> [289]  3.4884571 11.6075263  1.7889841  3.8325906 12.3258982  3.2773605
#> [295]  4.4804086 13.4434989  6.7556577  1.7851375  6.7439574  1.7967467
#> 
#> $final_loss
#> [1] 6.784421
#> 
#> $encoder
#>            [,1]
#> [1,] -0.5784259
#> 
#> $decoder
#>            [,1]
#> [1,] -0.5784259
#> 
#> $reconstruction
#>           [,1]
#> [1,] 0.7203264
#> [2,] 0.4593674
#> [3,] 1.1381654
#> [4,] 1.2255362
#> [5,] 0.5018139
#> [6,] 2.0194530
#> [7,] 0.9364437
#> [8,] 2.1499537
#> 
#> $corrupted
#>          [,1]
#> [1,] 2.152950
#> [2,] 1.372982
#> [3,] 3.401809
#> [4,] 3.662948
#> [5,] 1.499848
#> [6,] 6.035848
#> [7,] 2.798893
#> [8,] 6.425896
#> 
#> $noise
#>             [,1]
#> [1,] -0.34705031
#> [2,]  0.37298151
#> [3,] -0.09819093
#> [4,] -0.33705244
#> [5,] -0.50015198
#> [6,]  0.53584821
#> [7,] -0.20110749
#> [8,] -0.07410429
#> 
#> $clean_loss
#> [1] 6.784421
#> 
#> $denoising_gain
#> [1] 0.01779861
#> 
#> $snr_db
#> [1] 20.97797
#> 
#> $noise_energy
#> [1] 0.1207532
#> 
#> $passthrough_loss
#> [1] 0.1207532
#> 
#> $hidden
#> [1] 1
#> 
#> $noise_std
#> [1] 0.3
#> 
#> $estimate
#> [1] 6.784421
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "linear denoising autoencoder trained on corrupted inputs; evaluation delegated to grdae"
#>