f@0
|
1 % Script to reproduce the experiments leading to the results provided in the
|
f@0
|
2 % Table 2 of the paper "Deep Scattering Spectrum" by J. Andén and S. Mallat.
|
f@0
|
3
|
f@0
|
4 % M=2 scattering, frequency scattering
|
f@0
|
5
|
f@0
|
6 preffix = 'time_freq_scat_l2_';
|
f@0
|
7
|
f@0
|
8 N = 5*2^17;
|
f@0
|
9
|
f@0
|
10 global src;
|
f@0
|
11
|
f@0
|
12 filt1_opt.filter_type = {'gabor_1d','morlet_1d'};
|
f@0
|
13 filt1_opt.Q = [8 1];
|
f@0
|
14 filt1_opt.J = T_to_J(8192*2,filt1_opt);
|
f@0
|
15
|
f@0
|
16 sc1_opt.M = 2;
|
f@0
|
17
|
f@0
|
18 ffilt1_opt.filter_type = 'morlet_1d';
|
f@0
|
19 ffilt1_opt.J = 7;
|
f@0
|
20
|
f@0
|
21 fsc1_opt.M = 1;
|
f@0
|
22
|
f@0
|
23 Wop1 = wavelet_factory_1d(N, filt1_opt, sc1_opt);
|
f@0
|
24 fWop1 = wavelet_factory_1d(128, ffilt1_opt, fsc1_opt);
|
f@0
|
25
|
f@0
|
26 scatt_fun1 = @(x)(log_scat(renorm_scat(scat(x,Wop1))));
|
f@0
|
27 fscatt_fun1 = @(x)(func_output(@scat_freq,2,scatt_fun1(x),fWop1));
|
f@0
|
28 feature_fun1 = @(x)(format_scat(fscatt_fun1(x)));
|
f@0
|
29
|
f@0
|
30 features = {feature_fun1};
|
f@0
|
31
|
f@0
|
32 for k = 1:length(features)
|
f@0
|
33 fprintf('testing feature #%d...',k);
|
f@0
|
34 tic;
|
f@0
|
35 sz = size(features{k}(randn(N,1)));
|
f@0
|
36 aa = toc;
|
f@0
|
37 fprintf('OK (%.2fs) (size [%d,%d])\n',aa,sz(1),sz(2));
|
f@0
|
38 end
|
f@0
|
39
|
f@0
|
40 db = prepare_database(src,features);
|
f@0
|
41 db.features = single(db.features);
|
f@0
|
42 db = svm_calc_kernel(db,'gaussian','square',1:8:size(db.features,2));
|
f@0
|
43
|
f@0
|
44 optt.kernel_type = 'gaussian';
|
f@0
|
45 optt.C = 2.^[0:4:8];
|
f@0
|
46 optt.gamma = 2.^[-16:4:-8];
|
f@0
|
47 optt.search_depth = 3;
|
f@0
|
48 optt.full_test_kernel = 1;
|
f@0
|
49
|
f@0
|
50 classify(db, optt, preffix);
|