Artificial Neural Network Preprocessing in Real-Time Applications I've come across an issue with my ANN when attempting to port my offline analysis to an online, real-time, application. 

I currently train my algorithm using an array of input data, number of channels (columns) against number of samples (rows), and I preprocess the data by subtracting the samples mean and dividing through the standard deviation. This works well, and I'm getting accuracies for each of the output target values (4 targets in total) around 98%. 

However, in a real-time application, where only one sample is arriving at a time, I cannot apply this same preprocessing method, as I can't determine the mean and STD on a single sample! So far this is purely a feed-forward problem, using saved weights from the offline analysis.

The obvious solution is to not use that preprocessing method, but it's the only way I can get working results. If I remove the preprocessing method all together the ANN just doesn't work, and all estimates are put in the first target value. Same goes for trying to preprocess the data based on the single sample (i.e. the same method mentioned above but determining the mean and STD on the data x axis, instead of the y axis). 

I have two questions: 

1) Why is preprocessing in this manner necessary? What is happening when I subtract the mean and divide through the STD that makes everything work?

2) What can I do to correct this issue? The only idea I have is to save the mean and STD value for real-time processing, and then update the mean/STD as new samples are presented. 

Ideally I want a preprocessing method which I can perform on a single sample, or no preprocessing at all! Failing that, any suggestions on how you would go about this issue would be great.

Thanks.
The answer i give is probably partly help full.
What you can do is when you have a pre stored STD and MEAN(N samples long). While running the real time proces update the stored MEAN.
Create an array of you mean value. During the loop add every cycle a sample to your array and remove the oldest one. You create a kind of circular pattern. After N samples your MEAN is only the MEAN from your data.
Do the same with the STD.

Maybe you can create a different MEAN and STD from different types of data so the error is less worse  

Good Luck