Using LSTM for non-linear system identification
Mostrar comentarios más antiguos
Hello, i need some steps and information to build a neural network lstm for nonlinear system identification. I have already the data set, training set and test set. This is my code, what i need to do more?Please tell me
clear all
clc
load('twotankdata.mat');
output=y;
input=u;
%normalizarea datelor de intrare
min_input = min(input);
max_input = max(input);
x_normalized=(input-min_input)/(max_input-min_input);
min_output=min(output);
max_output=max(output);
y_normalized=(output-min_output)/(max_output-min_output);
x_train=x_normalized(1:2250,:);
x_test=x_normalized(2251:3000,:);
y_train=y_normalized(1:2250,:);
y_test=y_normalized(2251:3000,:);
%Define LSTM Network Arhitecture
model=lstmLayer(100,'OutputMode','sequence','StateActivationFunction','tanh','GateActivationFunction','sigmoid');
numFeatures=size(x_train',2);
inputSize=1;
numHiddenUnits=70;
numClasses=1;
layer=[...
sequenceInputLayer(inputSize)
lstmLayer(numHiddenUnits,'OutputMode','last')
fullyConnectedLayer(numClasses)
%softmaxLayer
regressionLayer
];
options=trainingOptions('adam',...
'ExecutionEnvironment','cpu',...
'MaxEpochs',250,...
'MiniBatchSize',27,...
'GradientThreshold',1,...
'Verbose',false,...
'Plots','training-progress');
net=trainNetwork(x_train',y_train',layer,options);
i have this error: Invalid training data. The output size (1) of the last layer does not match the response size (2250).
2 comentarios
KSSV
el 13 de Nov. de 2023
You need to attach your input data. Attach the mat file.
David Vatavu
el 13 de Nov. de 2023
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!