I understand that you are trying to create a sequence-to-one regression model. However, you are recieving an error regarding the responses (y_train) input parameter to the "trainNetwork" function. I see that since you are trying to acheive a single response for each sample(X_train), y_train has a dimentionality of n x 1.
It is my understanding that since you are providing sequence data, we also need to add an additional layer in the "layers" array which learns long term dependencies between time steps in the sequence data. We can add a "lstmLayer" with desired number of hidden memory units (depending on how much information the model should remember) along with the desired 'OutputMode' (in this case the 'OutputMode' is set to 'last' since the desired configuration of the regression model is sequence-to-one which is an extension of the sequence-to-sequence model). Find the redefined code for layers array below:
Please refer to the following links for more information:
Network architecture in sequence-to-sequence models: