- Deep Learning Tips and Tricks: https://www.mathworks.com/help/deeplearning/ug/deep-learning-tips-and-tricks.html
- Choosing a Network Architecture: https://www.mathworks.com/campaigns/offers/next/all-about-choosing-a-network-architecture.html
Multi variable prediction LSTM
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Riccardo
am 9 Mär. 2025
Beantwortet: praguna manvi
am 12 Mär. 2025
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!
0 Kommentare
Akzeptierte Antwort
praguna manvi
am 12 Mär. 2025
Choosing the right architecture depends on the complexity of the problem. Here are some resources that discuss which approach to take based on the type of problem:
Since you have only 1800 samples, it would be easier to fit them with a lighter network, as more parameters require more data. Also, since R2023b, it is recommended to use "trainnet" instead. Refer to the following link for more examples:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!