How can I build a Neural Network model for pattern recognition using two (2) sensor datasets?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I have two (2) sensor datasets (FRF datasets from two (2) accelerometers positioned at different locations), each dataset is of 6540 observations and 4000 features. I want to use a Neural Network for pattern recognition to classify eleven (11) conditions (1 fault-free case + 10 faulty cases).
I managed to get excellent results using one (1) dataset from one (1) sensor using this code:
% Creating the target matrices
% ti refers to the target matrix for the ith case. bi refers to the number of observations for the ith case.
t1 = zeros(11,b1); t1(1,:) = ones(1,b1); t2 = zeros(11,b2); t2(2,:) = ones(1,b2); t3 = zeros(11,b3); t3(3,:) = ones(1,b3);
t4 = zeros(11,b4); t4(4,:) = ones(1,b4); t5 = zeros(11,b5); t5(5,:) = ones(1,b5); t6 = zeros(11,b6); t6(6,:) = ones(1,b6);
t7 = zeros(11,b7); t7(7,:) = ones(1,b7); t8 = zeros(11,b8); t8(8,:) = ones(1,b8); t9 = zeros(11,b9); t9(9,:) = ones(1,b9);
t10 = zeros(11,b10); t10(10,:) = ones(1,b10); t11 = zeros(11,b11); t11(11,:) = ones(1,b11);
TARGETS = [t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11]; % The overall target 11*6540 matrix
INPUTS = Dataset; % The overall 4000*6540 dataset matrix. 4000 features and 6540 observations.
net = patternnet(20); [net,tr] = train(net,INPUTS,TARGETS); plotperform(tr)
testX = INPUTS(:,tr.testInd); testT = TARGETS(:,tr.testInd); testY = net(testX); testIndices = vec2ind(testY);
plotconfusion(testT,testY)
[c,cm] = confusion(testT,testY)
fprintf('Percentage Correct Classification : %f%%\n', 100*(1-c)); fprintf('Percentage Incorrect Classification : %f%%\n', 100*c);
plotroc(testT,testY)
Now, to use both datasets (from 2 sensors), I'm considering following the same method mentioned above for both datasets and then concatenate the relavent matrices creating one (4000*13080) INPUTS matrix and one (11*13080) TARGET matrix before applying the NN model.
Is there a better way? Please help, and thanks in advance!
0 commentaires
Réponse acceptée
Shreeya
le 29 Fév 2024
Hello
You can start by creating distribution plots to analyze if the features across the datasets are similar. If they are, then you can concatenate the two datasets and train it on one model.
But, if the distributions are not similar, having a single model may decrease the performance. In this case, you can have two seperate models which are tuned according to the specific datasets.
Also, if the distributions are similar and still the model does not perform well on the concatenated dataset, there may be some overfitting in your results.
3 commentaires
Shreeya
le 29 Fév 2024
Perhaps what you are looking for is the usage of ensemble learning. You can achieve this using any of the below approaches:
- Voting: Combine the two sub models and use a voting based criteria to determine the best results. Refer to the link below for the implementation of this in MATLAB: https://www.mathworks.com/matlabcentral/answers/460240-how-to-apply-majority-voting-for classification-ensemble-in-matlab?s_tid=answers_rc1-2_p2_MLT
- Stacking: Use the predictions of the submodels as inputs to a new model, which learns to best combine the predictions. Refer to the link below to learn more:
Thanks!
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!