[40] | 1 | % what do the simple approaches give? |
---|
| 2 | load cellssimplevar; |
---|
| 3 | gaborvar_train = a; gaborvar_test = b; |
---|
| 4 | load cellssimplemax; |
---|
| 5 | gabormax_train = a; gabormax_test = b; |
---|
| 6 | load cellssimplemean; |
---|
| 7 | gabormean_train = a; gabormean_test = b; |
---|
| 8 | gabor_data=[gabor_train;gabor_test]; |
---|
| 9 | load cells_lbp_mask; gencellsimple |
---|
| 10 | lbp_train = a; lbp_test = b; |
---|
| 11 | load cells_lbp_gauss3; gencellsimple |
---|
| 12 | lbpold_train = a; lbpold_test = b; |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | % param: |
---|
| 16 | %dim_gabor = size(gabor_train,2); |
---|
| 17 | %dim_lbp = size(lbp_train,2); |
---|
| 18 | %dim = dim_gabor+dim_lbp; |
---|
| 19 | %u = [featsel(dim,1:dim_gabor)*ldc featsel(dim,dim_gabor+(1:dim_lbp))*ldc]*meanc; |
---|
| 20 | %u = fisherm([],4)*knnc; |
---|
| 21 | %u = combinerm(ldc([],0,1e-5),gaborvar_train,gabormax_train,gabormean_train,lbp_train,lbpold_train)*ldc([],0,1e-5); |
---|
| 22 | u = combinerm(loglc2,gaborvar_train,gabormax_train,gabormean_train,lbp_train,lbpold_train)*maxc; |
---|
| 23 | %u = knnc; |
---|
| 24 | u = loglc2; |
---|
| 25 | u = scalem([],'variance')*libsvc; |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | % train and test: |
---|
| 30 | w = [gaborvar_train gabormax_train gabormean_train lbp_train lbpold_train]*u; |
---|
| 31 | error_on_testset = [gaborvar_test gabormax_test gabormean_test lbp_test lbpold_test]*w*testc |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | % crossval on all data a: |
---|
| 35 | a = [[gaborvar_train;gaborvar_test] [gabormax_train;gabormax_test] ... |
---|
| 36 | [gabormean_train;gabormean_test] [lbp_train;lbp_test] ... |
---|
| 37 | [lbpold_train;lbpold_test]]; |
---|
| 38 | |
---|
| 39 | imlab = getident(a,'image'); |
---|
| 40 | [nlab,baglab] = renumlab(imlab); |
---|
| 41 | nrfolds = length(baglab); % leave one image out |
---|
| 42 | |
---|
| 43 | e = zeros(nrfolds,1); |
---|
| 44 | Iall = (1:size(nlab,1))'; |
---|
| 45 | |
---|
| 46 | for i=1:nrfolds |
---|
| 47 | Jtst = find(nlab==i); |
---|
| 48 | Jtrn = Iall; Jtrn(Jtst)=[]; |
---|
| 49 | |
---|
| 50 | i |
---|
| 51 | x = a(Jtrn,:); |
---|
| 52 | z = a(Jtst,:); |
---|
| 53 | %f(i) = find(classsizes(z)>0) |
---|
| 54 | |
---|
| 55 | w = x*u; |
---|
| 56 | e(i,1) = z*w*testd; |
---|
| 57 | %e(i,1) |
---|
| 58 | end |
---|
| 59 | e |
---|
| 60 | mean(e) |
---|
| 61 | error_on_testset |
---|
| 62 | |
---|
| 63 | |
---|