Trains an autoencoder adapted to the data and extracts its encoding for the same data matrix.
autoencode(data, dim, type = "basic", activation = "linear", epochs = 20)Numeric matrix to be encoded
Number of variables to be used in the encoding
Type of autoencoder to use: "basic", "sparse", "contractive",
"denoising", "robust" or "variational"
Activation type to be used in the encoding layer. Some available
activations are "tanh", "sigmoid", "relu", "elu" and "selu"
Number of times the data will traverse the autoencoder to update its weights
Matrix containing the encodings
\link{autoencoder}
inputs <- as.matrix(iris[, 1:4])
# \donttest{
if (keras::is_keras_available()) {
# Train a basic autoencoder and generate a 2-variable encoding
encoded <- autoencode(inputs, 2)
# Train a contractive autoencoder with tanh activation
encoded <- autoencode(inputs, 2, type = "contractive", activation = "tanh")
}
# }