Creating & Visualizing Neural Network in R - Analytics Vidhya



Reference is made from the link

What if I want to use the trained NN model to forecast with the new data set that was not used in the normalization process?


Hi @fanwood,

If you have normalized the data for training the neural network and while testing, you use non normalized data, the results might not be accurate.

So, make sure you do all the pre-processing steps on test data as well which you have done for training data that would help you to get better predictions.


Thanks for your input.
My question is I want to use the trained NN model to forecast with the dataset that was not used in training or testing.
I believe this data needs to be normalized too, but how should it be done? And what about the final predict from this process especially taking the data back to normal predicted values.

Check this
predict_testNN = compute(NN, testNN[,c(1:5)])

This testNN was used in the normalization process. Now assume it is new dataset mydata with 1:5 columns. How is the normalization be done on this?

After then what about the prediction over here (Something like this below) will it be the same or will change? if yes how?
predict_testNN = (predict_testNN$net.result * (max(data$rating) - min(data$rating))) + min(data$rating)

Hope now it is well understood.


Hi @fanwood,

Just follow the similar steps that you have used for training data to normalize new data.

Yes, you have to take the predictions back to the unnormalized form, if you have normalized your target variable. If you have not normalized the target variable, there is no need to scale back the predictions as they will be in the required format.

Predictions will be different as normalizing is helpful most of the time. I believe that normalizing the data will lead to better results. Note that it is not always necessary that normalizing will always improve the performance. You just have to experiment and then compare the results.