Learn R Programming

nnlib2Rcpp (version 0.2.9)

Autoencoder: Autoencoder NN

Description

A neural network for autoencoding data, projects data to a new set of variables.

Usage

Autoencoder(
  data_in,
  desired_new_dimension,
  number_of_training_epochs,
  learning_rate,
  num_hidden_layers = 1L,
  hidden_layer_size = 5L,
  show_nn = FALSE,
  error_type = "MAE",
  acceptable_error_level = 0,
  display_rate = 1000)

Value

Returns a numeric matrix containing the projected data.

Arguments

data_in

data to be autoencoded, a numeric matrix, (2d, cases in rows, variables in columns). It is recommended to be in [0 1] range.

desired_new_dimension

number of new variables to be produced. This is effectively the size (length) of the special hidden layer that outputs the new variable values, thus the dimension of the output vector space.

number_of_training_epochs

number of training epochs, aka presentations of all training data to ANN during training.

learning_rate

the learning rate parameter of the Back-Propagation (BP) NN.

num_hidden_layers

number of hidden layers on each side of the special layer.

hidden_layer_size

number of nodes (processing elements or PEs) in each of the hidden layers. In this implementation of Autoencoder all hidden layers are of the same length (defined here), except for the special hidden layer (whose size is defined by desired_new_dimension above).

show_nn

boolean, option to display the (trained) ANN internal structure.

error_type

string, error to display and possibly use to stop training (must be 'MSE' or 'MAE').

acceptable_error_level

stops training when error is below this level.

display_rate

number of epochs that pass before current error level is displayed (0 = never display current error).

Author

Vasilis N. Nikolaidis <vnnikolaidis@gmail.com>

References

Nikolaidis V.N., Makris I.A, Stavroyiannis S, "ANS-based preprocessing of company performance indicators." Global Business and Economics Review 15.1 (2013): 49-58.

See Also

BP.

Examples

Run this code
iris_s <- as.matrix(scale(iris[1:4]))
output_dim <- 2
epochs <- 100
learning_rate <- 0.73
num_hidden_layers <-2
hidden_layer_size <- 5

out_data <-  Autoencoder( iris_s, output_dim,
                          epochs, learning_rate,
                          num_hidden_layers, hidden_layer_size, FALSE)

plot( out_data,pch=21,
      bg=c("red","green3","blue")[unclass(iris$Species)],
      main="Randomly autoencoded Iris data")

Run the code above in your browser using DataLab