Merge branch 'fixf'
[wrf-fire-matlab.git] / fuel_left / full_train.m
bloba0955ab90faab5f056b47507d6e6a245ec9090ee
1 %script creates data and trains the network. It then creates new data and
2 %tests the network
4 n = input_num('How many samples to create?',10000);
5 %create samples
7 %from uniform distribution
8 %s = time_samps(n);
9 %from gaussian distribution
10 s = gauss_samps(n, 0.8,0.5);
12 %s(:,1:4) = rotate_cell(s(:,1:4));
14 %perform integrals
15 fprintf('Computing Integrals on data, be patient...\n')
16 %r = fuel_int(s);
17 r = fuel_quad(s,50);
19 fprintf('Now training the network \n')
20 train_simple
22 %create new set of data
23 s2 = time_samps(n);
24 tic 
25 r2 = fuel_quad(s2,50);
26 toc
28 %use network to evaulate integrals
29 tic
30 y2 = net(s2');
31 %set outlier values to zero or one
32 y2(y2>1)=1;
33 y2(y2<0)=0;
35 toc
37 %scatter plot of quadrature and network outputs
38 figure,scatter(r2,y2)
39 title('Network and integral evaluations')
40 xlabel('Integral values')
41 ylabel('Network values')
43 %histogram of differences
44 d = r2-y2;
45 figure,histogram(d)
46 title('Integral - Network')
47 xlabel('int - net')
48 ylabel('Instances')
50 fprintf('Maximum absolute difference is %f \n',max(abs(d)))
51 fprintf('Mean of difference is %f \n',mean(d))
52 fprintf('Variance of difference is %f \n',var(d))
54