MLP_regression: Multilayer Perceptron

Description Usage Arguments Value Examples

Description

Performs a multilayer perceptron regression.

Usage

1
2
MLP_regression(X_train, Y_train, X_test, n_neurons, weight_decay = 0,
  max_iter = 1000)

Arguments

X_train

A Matrix of trainning observations.

Y_train

A numeric vector of classes or values of the trainning observations.

X_test

A Matrix of testing observations.

n_neurons

Number of neurons in the hidden layer.

weight_decay

Weigth decay parameter for neural network.

max_iter

Maximun number of trainning iterations.

Value

predicted values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
X <- as.matrix(cbind(runif(n = 100), runif(n = 100)))
Y <- 3*X[, 1] - 2.5*X[, 2] + 0.2 * runif(100)
pos <- sample(100, 70)
X_train <- X[pos, ]
X_test <- X[-pos, ]
Y_train <- Y[pos]
Y_test <- Y[-pos]
n_neurons <- 20
Y_predicted <- MLP_regression(X_train = X_train, Y_train = Y_train, X_test = X_test, n_neurons = n_neurons)
plot(x = (1:100)[-pos], y = Y_test, col = 'red')
points(x = (1:100)[-pos], y = Y_predicted, col = 'blue')

PauloCirino/MLAT documentation built on May 13, 2019, 1:22 p.m.