-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeepLearning.m
72 lines (56 loc) · 1.49 KB
/
DeepLearning.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function DeepLearning()
clear all; clc;
close all;
% ImageName =[];
% Accuracy=[];
% Precision=[];
% Recall=[];
% Specificity=[];
% Fscore=[];
% MCC = [];
fea_Files = dir('data/dataset/*.mat');
impoFeatures = [25 32 29 30 23 27 26 34 19 24 22 20];
for ra=1:size(fea_Files,1)
disp(sprintf('%d) %s',ra,fea_Files(ra).name));
test= load(fea_Files(ra).name);
trainX=[];
trainY=[];
testX=[];
testY=[];
testX = test.AvDataset.Features;
testY = test.AvDataset.Label;
for i=1:size(fea_Files,1)
if(ra~=i)
train = load(fea_Files(i).name);
trainX = [trainX;train.AvDataset.Features];
trainY = [trainY;train.AvDataset.Label];
end
end
train_x = toZeroOne(trainX);
test_x = toZeroOne(testX);
test_x = test_x(:,impoFeatures);
test_y = double(testY);
differ = rem(size(train_x,1),100);
trainLen = size(train_x,1)-differ;
train_x = train_x(1:trainLen,impoFeatures);
train_y = trainY(1:trainLen,:);
trY=[];
tsY=[];
for n=1:trainLen
if(train_y(n)==0)
trY=[trY;1,0];
else
trY=[trY;0,1];
end
end
for n=1:size(test_y,1)
if(test_y(n)==0)
tsY=[tsY;1,0];
else
tsY=[tsY;0,1];
end
end
train_y=trY; clear trY;
test_y=tsY; clear tsY;
end
end