Predicting labels based on a model trained by neuralnet
Similar to other classification methods, we can predict the labels of new observations based on trained neural networks. Furthermore, we can validate the performance of these networks through the use of a confusion matrix. In the following recipe, we will introduce how to use the compute
function in a neural network to obtain a probability matrix of the testing dataset labels, and use a table and confusion matrix to measure the prediction performance.
Getting ready
To complete this recipe, you need to have completed the previous recipe by generating the training dataset, trainset
, and the testing dataset, testset
. The trained neural network needs to be saved in the network.
How to do it...
Perform the following steps to measure the prediction performance of the trained neural network:
- First, generate a prediction probability matrix based on a trained neural network and the testing dataset,
testset
:
> net.predict = compute(network...