Computation of a given neural network for given covariate vectors
compute, a method for objects of class
Computes the outputs of all neurons for specific arbitrary covariate vectors given a trained neural network. Please make sure that the order of the covariates is the same in the new matrix or dataframe as in the original neural network.
compute(x, covariate, rep = 1)
- an object of class
- a dataframe or matrix containing the variables that had been used to train the neural network.
- an integer indicating the neural network's repetition which should be used.
computereturns a list containing the following components:
Var1 <- runif(50, 0, 100) sqrt.data <- data.frame(Var1, Sqrt=sqrt(Var1)) print(net.sqrt <- neuralnet(Sqrt~Var1, sqrt.data, hidden=10, threshold=0.01)) compute(net.sqrt, (1:10)^2)$net.result