wolffd@0
|
1 % ---
|
wolffd@0
|
2 % This script trains similarity measures and evaluates the
|
wolffd@0
|
3 % impact of the number of hidden states as displayed in figure 3 of
|
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 % The output is printed in the console and plotted afterwards
|
wolffd@0
|
9 %
|
wolffd@0
|
10 % please note that the RBM training is a probabilistic process, and
|
wolffd@0
|
11 % thus the papers' results can only be reproduced approximately with
|
wolffd@0
|
12 % large numbers iterations of this script, and selection of RBMs according to
|
wolffd@0
|
13 % their training set performance.
|
wolffd@0
|
14 % ---
|
wolffd@0
|
15
|
wolffd@0
|
16 % this version reproduces the figure approximately using precomputed RBM
|
wolffd@0
|
17 [test(1), train(1)] = rbm_fig3('rbm_h30');
|
wolffd@0
|
18 [test(2), train(2)] = rbm_fig3('rbm_h50');
|
wolffd@0
|
19 [test(3), train(3)] = rbm_fig3('rbm_h100');
|
wolffd@0
|
20 [test(4), train(4)] = rbm_fig3('rbm_h500');
|
wolffd@0
|
21 [test(5), train(5)] = rbm_fig3('rbm_h1000');
|
wolffd@0
|
22
|
wolffd@0
|
23 % optionally, in order to test new RBMs, use the code below
|
wolffd@0
|
24 % [test(1), train(1)] = rbm_fig3(30);
|
wolffd@0
|
25 % [test(2), train(2)] = rbm_fig3(50);
|
wolffd@0
|
26 % [test(3), train(3)] = rbm_fig3(100);
|
wolffd@0
|
27 % [test(4), train(4)] = rbm_fig3(500);
|
wolffd@0
|
28 % [test(5), train(5)] = rbm_fig3(1000);
|
wolffd@0
|
29
|
wolffd@0
|
30 hidNum = [30 50 100 500 1000];
|
wolffd@0
|
31 hFig = figure;
|
wolffd@0
|
32 set(hFig,'Units','centimeters');
|
wolffd@0
|
33 set(hFig, 'Position', [10 10 10 6]);
|
wolffd@0
|
34 plot(hidNum,train*100,'--rx');
|
wolffd@0
|
35 hold on
|
wolffd@0
|
36 plot(hidNum,test*100,'-bo');
|
wolffd@0
|
37 lg = legend('Training','Test');
|
wolffd@0
|
38 set(lg,'Location','SouthEast');
|
wolffd@0
|
39 title ('Figure 4: GRADIENT results for different hidNum');
|