-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTesting.m
More file actions
24 lines (15 loc) · 948 Bytes
/
Testing.m
File metadata and controls
24 lines (15 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
%% EECS351 Project test
Numneighbors = 10;
[idx,weights]=relieff(mfccTrain,trainLabels,Numneighbors); %Determine most important KNN predictors
predictors = 3000; %Decide predictor cutoff
mfcctraintrimmed = zeros(size(trainLabels,1),1); %empty matrix for trimmed mfcc, hard coded
for k = 1:1:predictors
mfcctraintrimmed(:,k)=mfccTrain(:,idx(k)); %populate with most important predictors
end
mfcctesttrimmed = zeros(size(mfcctest,1),1); %empty trimmed mfcc array
for l = 1:1:predictors
mfcctesttrimmed(:,l)=mfcctest(:,idx(l)); %populate with most important predictors
end
Mdl=fitcknn(mfcctraintrimmed,trainLabels, "Numneighbors", Numneighbors);
predicted = predict(Mdl,mfcctesttrimmed); %predict for test array with trained model
confusionchart(actual,predicted)