Last chance! 50% off unlimited learning
Sale ends in
Artificial Neural Network VAR (Vector Auto-Regressive) model using a MultiLayer Perceptron.
varmlp(df, lag, sizeOfHLayers, iters, bias = TRUE)
A numerical dataframe
The lag parameter.
Integer vector that contains the size of hidden layers, where the length of this vector is the number of hidden layers, and the i-th element is the number of neurons in the i-th hidden layer.
The number of iterations.
Logical, true if the bias have to be used in the network.
train (df): updates the model using the input dataframe.
forecast (df): returns the next row forecasts of an given dataframe.
This function builds the model, and returns an object that can be used to make forecasts and can be updated using new data.
# NOT RUN {
library (timeSeries) # to extract time series
library (NlinTS)
#load data
data = LPP2005REC
# Prepare data to make one forecasts
train_data = head (data, nrow (data) - 1)
test_data = tail (data, 1)
model = varmlp (train_data, 1, c(10,5), 200, TRUE)
predictions = model$forecast (train_data)
print (tail (predictions,1))
# Update the model (learning from new data)
model$train (test_data)
# }
Run the code above in your browser using DataLab