Multi variable prediction LSTM
Mostrar comentarios más antiguos
Hi,
I am trying to train a network on a dataset. I would like to predict the coefficients of a spline that represent a contact force between to impacting objects and the total contact time. The spline coefficient vector has variable length depending on the case but as of now I get predictions of the same length ( set to the maximum lenght of the coefficients vector). This is the code I've written
inputTable = table;
predictorNames = {'v_i', 'E_tip', 'rho_tip', 'v_tip', 'Y_tip', ...
'Radius', 'E_plate', 'rho_plate', 'v_plate', 'Y_plate', 'Insulator'};
predictors = inputTable{:, predictorNames}';
maxLen = max(cellfun(@numel, inputTable.Sp));
responseCoeffs = zeros(maxLen, length(inputTable.Sp));
scalarResponse = inputTable.ContactTime;
for i = 1:length(inputTable.Sp)
coeffs = inputTable.Sp{i};
responseCoeffs(1:numel(coeffs), i) = coeffs;
end
predictors = normalize(predictors, 2);
responseCoeffs = normalize(responseCoeffs, 2);
scalarResponse = normalize(scalarResponse);
numFeatures = size(predictors, 1);
numSplineCoeffs = maxLen;
% LSTM
layers = [
sequenceInputLayer(numFeatures)
lstmLayer(50, 'OutputMode', 'sequence')
fullyConnectedLayer(100)
reluLayer
fullyConnectedLayer(numSplineCoeffs + 1)
regressionLayer
];
options = trainingOptions('adam', ...
'MaxEpochs', 1000, ...
'MiniBatchSize', 32, ...
'Shuffle', 'every-epoch', ...
'Plots', 'training-progress', ...
'Verbose', true);
fullResponse = [responseCoeffs; scalarResponse'];
net = trainNetwork(predictors, fullResponse, layers, options);
This is my first time trying to train a network so any advice even on where to find more information on how to select the corret type of network would be much appreciated.
Thanks in advance!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows 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!