Deep Neural Network process

2 views (last 30 days)
MAT-Magic
MAT-Magic on 5 Apr 2020
Answered: Asvin Kumar on 12 Apr 2020
Hi all,
Actually, I am using single layer feed-forward (SLFN) neural network for prediction of next 4, 5, and 6 samples ahead in a signal having sampling frequency 10 Hz. I have a big CONFUSION in training and testing.
How will I do training for predicting aforementioned ahead samples on for example 70% of the data, and rest of it will use for testing?
%% Things have been tried so far:
moving_window_length = 5;
single_sample_ahead = 6;
Question # 01: (Training Phase) That's 1 to 5 samples took to predict sixth one (single step). Same for 2 to 6 to predict seventh one. Is it doing right?
Question # 02: If question # 01 is correct, then can I take 1 to 5 samples to predict 11th (multi-step ahead samples {6 samples}) sample in training?
Question # 03: (Testing Phase) If above two assumptions are correct, then how will I visualize in testing that my model is predicting 6 samples ahead prediction?
I am waiting for your kind reply.
Greg, I am also waiting for your kind reply.

Answers (1)

Asvin Kumar
Asvin Kumar on 12 Apr 2020
Although I’m not sure which functions you are using to implement your Feedforward Network, I should still be able to answer your questions. I’m going to assume you’re referring to feedforwardnet.
Q#01: Technically, you could do it. You can create a training dataset with 5 simples per input taken with a rolling window as you had mentioned and then appropriately take the next sample as the output. Your Feedforward Network will learn a mapping from the input five elements to the expected following element.
Q#02: This question is unclear to me as to why you would want to predict the 11th sample in the training phase. As for the prediction alone, you can’t directly predict the 11th sample by passing the first five samples as input because the network is not trained to learn that mapping. You can predict the 6th sample, use it to predict the 7th sample and so on until you can predict the 11th sample.
Q#03: For visualization, consider plotting the signals in a shifted manner. You could plot your predicted signal and then the original signal shifted by 6 samples. If you do not want to plot shifted signals, you can plot both the signals directly and you should be able to visibly see the time shift if the model is trained properly because the actual signal would lag the predicted signal.
Having said all that, we should note that simple Feedforward Networks do not use any temporal information. It is highly recommended you use LSTMs to learn temporal mapping. You could again do a similar construction of the dataset and go ahead. In this case, the model also learns the temporal information between the samples which might be essential to your problem.
Here are a couple of examples if you’re looking to get started with LSTMs: https://www.mathworks.com/help/deeplearning/deep-learning-with-time-series-sequences-and-text.html?s_tid=CRUX_lftnav
Just an aside, for your frequency of 10 Hz, it makes sense to learn mapping between samples directly. If your use case involved higher frequency rates such as when dealing with Audio or EEG signals, you might have to use some common pre-processing techniques such as MFCC extraction or Passband filtering following by STFT as necessary.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!