
Sparse autoencoder objective (Geron Ch 17, morie.fn grsae)
Source:R/geron_train_native.R
morie_geron_sparse_autoencoder.RdL = ||x - dec||^2 + lam ||h||_1; the L1 zeroes units outright.
Examples
morie_geron_sparse_autoencoder(x = c(1, 2, 3, 4, 5, 6, 7, 8),
hidden = c(1, 2, 3, 4, 5, 6, 7, 8), decoded = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $loss
#> [1] 0.036
#>
#> $reconstruction_loss
#> [1] 0
#>
#> $l1_penalty
#> [1] 0.036
#>
#> $sparsity
#> [1] 0
#>
#> $mean_activation
#> [1] 4.5
#>
#> $code_size
#> [1] 8
#>
#> $estimate
#> [1] 0.036
#>
#> $n
#> [1] 1
#>