Mercurial > hg > camir-aes2014
comparison reproduce_AES53rd/rerun_gradient_table3/gradient_table3.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 % cr_: training correct | |
2 % cr : testing correct | |
3 feature_file = 'rel_music_raw_features+simdata_ISMIR12'; | |
4 vars = whos('-file', feature_file); | |
5 A = load(feature_file,vars(1).name,vars(2).name,vars(3).name,vars(4).name); | |
6 raw_features = A.(vars(1).name); | |
7 indices = A.(vars(2).name); | |
8 tst_inx = A.(vars(3).name); | |
9 trn_inx = A.(vars(4).name); | |
10 % | |
11 % figure(1); imagesc(raw_features);colorbar; | |
12 mod = load('res_48'); | |
13 features = logistic(raw_features*mod.W_max{1} + repmat(mod.hB_max{1},size(raw_features,1),1)); | |
14 % figure(2); imagesc(features);colorbar; | |
15 | |
16 num_case = size(trn_inx,1); | |
17 [trnd_12 trnd_13] = subspace_distances(trn_inx,features,indices,1,1); | |
18 [tstd_12 tstd_13] = subspace_distances(tst_inx,features,indices,1,1); | |
19 cr_ = 0; % correct rate for training | |
20 cr = 0; % correct rate for testing | |
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
22 %% CODE HERE %% | |
23 %[Ws cr_] = gradient_ascent(trnd_12,trnd_13,0.1,0.1,0.00002); %eNum = 10 | |
24 [Ws cr_] = gradient_ascent(trnd_12,trnd_13,0.05,0.01,0.00002); | |
25 | |
26 for i = 1:num_case | |
27 cr = cr + sum((tstd_13{i}-tstd_12{i})*Ws{i}' > 0, 1)/size(tstd_12{i},1); | |
28 end | |
29 cr = cr/num_case; | |
30 %% Check the result | |
31 fprintf('Gradient RBM Test / Train Result=%f / %f\n',cr*100,cr_*100); | |
32 %fprintf('Training=%f Testing=%f\n',cr_,cr); |