-
Notifications
You must be signed in to change notification settings - Fork 13
/
isomp_Indiana.m
45 lines (29 loc) · 876 Bytes
/
isomp_Indiana.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
close all;
clear;
clc;
load Indiana_16class.mat;
load IndexNeighbors\IndexNeighbors9x9.mat;
% ¹æ·¶»¯
fea = SamplesNormalize(fea);
[IndexTrainSet, IndexTestSet] = findlabel2(0.1,labels);
Xl = fea(:,IndexTrainSet);
Yl = labels(IndexTrainSet);
num_test = length(IndexTestSet);
num_train = length(IndexTrainSet);
S = sparse(num_train, num_test);
predict_label = zeros(1,num_test);
B = Xl;
h_waitbar = waitbar(0);
global BtB; BtB = B'*B; % Ô¤¼ÆËã
tic;
for j = 1:num_test
T = 30;
Xg = fea(:,[IndexTestSet(j) IndexNeighbors{IndexTestSet(j)}]);
[Sg, indSet] = SOMP(Xg, B, T);
S(:,j) = Sg(:,1);
predict_label(j) = assign_label_group(B(:,indSet),Sg(indSet,:),Xg,Yl(indSet));
if mod(j,100)==0 waitbar(j/num_test, h_waitbar, num2str(j/num_test));
end
end
toc;
test_accuracy = sum(predict_label==labels(IndexTestSet))/num_test;