wolffd@0
|
1 % ---
|
wolffd@0
|
2 % This script plots 50-dimensional RBM features as in figure 2 of
|
wolffd@0
|
3 %
|
wolffd@0
|
4 % Feature Preprocessing with RBMs for Music Similarity Learning
|
wolffd@0
|
5 % Son N. Tran, Daniel Wolff, Tillman Weyde, Artur Garcez, AES53rd
|
wolffd@0
|
6 % conference
|
wolffd@0
|
7 % ---
|
wolffd@0
|
8
|
wolffd@0
|
9 % cr_: training correct
|
wolffd@0
|
10 % cr : testing correct
|
wolffd@0
|
11 feature_file = 'rel_music_raw_features+simdata_ISMIR12';
|
wolffd@0
|
12 vars = whos('-file', feature_file);
|
wolffd@0
|
13 A = load(feature_file,vars(1).name,vars(2).name,vars(3).name,vars(4).name);
|
wolffd@0
|
14 raw_features = A.(vars(1).name);
|
wolffd@0
|
15 indices = A.(vars(2).name);
|
wolffd@0
|
16 tst_inx = A.(vars(3).name);
|
wolffd@0
|
17 trn_inx = A.(vars(4).name);
|
wolffd@0
|
18 %
|
wolffd@0
|
19 figure(1); imagesc(raw_features);colorbar;
|
wolffd@0
|
20 title 'Original Features';
|
wolffd@0
|
21
|
wolffd@0
|
22 % load pregenerated RBM features
|
wolffd@0
|
23 mod = load('rbm_50');
|
wolffd@0
|
24
|
wolffd@0
|
25 % ---
|
wolffd@0
|
26 % uncomment the following line to use newly calculated RBM features
|
wolffd@0
|
27 % mod = new_rbm(50,'grad');
|
wolffd@0
|
28 % ---
|
wolffd@0
|
29
|
wolffd@0
|
30 features = logistic(raw_features*mod.W_max{1} + repmat(mod.hB_max{1},size(raw_features,1),1));
|
wolffd@0
|
31 figure(2); imagesc(features);colorbar;
|
wolffd@0
|
32 title 'RBM Features';
|
wolffd@0
|
33
|
wolffd@0
|
34 num_case = size(trn_inx,1);
|
wolffd@0
|
35 [trnd_12 trnd_13] = subspace_distances(trn_inx,features,indices,1,1);
|
wolffd@0
|
36 [tstd_12 tstd_13] = subspace_distances(tst_inx,features,indices,1,1);
|
wolffd@0
|
37 cr_ = 0; % correct rate for training
|
wolffd@0
|
38 cr = 0; % correct rate for testing
|
wolffd@0
|
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|