Skip to contents

Encoder matrices in, tied transposes back out; the bottleneck is enforced and the tower's symmetry checked. No biases.

Usage

morie_geron_stacked_autoencoder(
  x,
  layer_weights,
  activation = "relu",
  tied = TRUE,
  output_activation = "linear"
)

Arguments

x

Input batch.

layer_weights

List of weight matrices.

activation

"relu", "sigmoid", "tanh" or "linear".

tied

Reuse the transposed encoder weights as the decoder.

output_activation

Activation of the final decoder layer.

Value

List with reconstruction, code, activations, reconstruction_error, compression, tied.

Examples

set.seed(6)
x <- matrix(rnorm(12), 3, 4)
W1 <- matrix(rnorm(8, 0, 0.3), 4, 2)
r <- morie_geron_stacked_autoencoder(x, list(W1), activation = "relu",
                                     tied = TRUE)
str(r, max.level = 1)
#> List of 8
#>  $ reconstruction      : num [1:3, 1:4] 0.01571 0.38394 0.02002 -0.00886 -0.24605 ...
#>  $ code                : num [1:3, 1:2] 0.0802 0 0.1022 0 0.7494 ...
#>  $ activations         :List of 3
#>  $ reconstruction_error: num 0.948
#>  $ compression         : num 2
#>  $ tied                : logi TRUE
#>  $ estimate            : num [1:3, 1:4] 0.01571 0.38394 0.02002 -0.00886 -0.24605 ...
#>  $ n                   : int 3