# How can I build a Neural Network model for pattern recognition using two (2) sensor datasets?

6 visualizzazioni (ultimi 30 giorni)
Hussein il 28 Feb 2024
Commentato: Hussein il 29 Feb 2024
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.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Shreeya il 29 Feb 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 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Shreeya il 29 Feb 2024
Perhaps what you are looking for is the usage of ensemble learning. You can achieve this using any of the below approaches:
Thanks!
Hussein il 29 Feb 2024
Yes, you're right. looking for something similar. Thanks a lot for your guidance.

Accedi per commentare.

### Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by