How do I use trainNetwork for a sequence-to-one regression?
Show older comments
Hi there,
I'm trying to create a model for a sequence-to-one regression. But sadly I receive an error:
Invalid training data. If the network outputs sequences, then regression responses must be a cell array of numeric sequences, or a single numeric sequence.
My Dataset: (a snapshot with 128 samples is attached - see .mat file)
load dataset.mat
whos X_train y_train
size(X_train) % 128x1 cell (128 samples)
size(X_train{1}) % 35x168 double (35 features with 168 time steps each)
size(y_train) % 128x1 double (1 numeric output for each sample)
My Network:
layers = [
sequenceInputLayer(35) % number of features
fullyConnectedLayer(42) % dummy value
tanhLayer
fullyConnectedLayer(1) % number of responses per sample
regressionLayer
];
options = trainingOptions('adam', 'MaxEpochs', 1);
trainNetwork(X_train, y_train, layers, options)
After reading the docs of Train deep learning neural network - MATLAB trainNetwork - MathWorks Deutschland I don't see my mistake.
From my point of view I'm doing the same thing as shown in the example from Sequence input layer - MATLAB - MathWorks Deutschland except I'm doing a regression instead of categorization.
openExample('matlab/DivideArrayAndReturnSubarraysInCellArrayExample')
Accepted Answer
More Answers (0)
Categories
Find more on Preprocess Data for Deep Neural Networks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!