source: trunk/private/script_app.m @ 23

Last change on this file since 23 was 19, checked in by pinsard, 15 years ago

add tool to run script_correc.m and save stdout, stderr and figures

File size: 2.1 KB
Line 
1%SCRIPT_APP correction
2
3%+
4% module
5% ======
6%
7% correction du TP
8%
9%
10% DESCRIPTION
11% ===========
12%
13% ++
14%
15% ``script_app``
16%
17% If ``fid_log`` is not set, log informations are printed on stdout.
18%
19% +++If ``fid_log`` set previous launching ``script_correc`` to more than 1,
20% log informations are saved in ``script_correc.log``.
21%
22% EXAMPLES
23% ========
24%
25% This script can not be launched directly.
26%
27% see script_correc.m_
28%
29% SEE ALSO
30% ========
31%
32% script_correc.m_
33%
34% .. _script_correc.m : script_correc.m.html
35%
36%
37% TODO
38% ====
39%
40% improve description
41%
42% EVOLUTIONS
43% ==========
44%
45% $Id$
46%
47% - fplod 2009-08-18T15:41:07Z aedon.locean-ipsl.upmc.fr (Darwin)
48%
49%   * add header
50%   * log information either on screen (stdout) or in file associated to
51%     fid_log file identifier and already opened
52%
53%-
54%
55% définition du fichier de sortie "Affichage"
56% if not set, fid_log is set to 1 (stdout)
57if ~ exist('fid_log','var')
58 fid_log = 1;
59end
60
61% +++vérification si ouverture du fichier de sortie "Affichage" si différent
62% de stdout
63fid_log_is_stdout = isequal(fid_log,1);
64if fid_log_is_stdout == 0
65 fullfilename = ['./', mfilename, '.log'];
66 fid_log = fopen(fullfilename,'w');
67 clear fullfilename;
68end
69
70archi=[20 40 60 80 100];
71init=[1 2];
72
73nets=repmat(struct('W1',[],'W2',[]),length(archi),length(init));
74perf=nan*ones(length(archi),length(init));
75
76for n=1:length(archi)
77  for i=1:length(init)
78
79    fprintf(fid_log,'\nApprentissage %d neurones cachees, initialisation #%d\n',archi(n),init(i));
80    %Init du reseau
81    [nets(n,i).W1 nets(n,i).W2]=MLPinit(base_app_n(:,1:end-1),base_app_n(:,end),archi(n));
82
83    %Apprentissage du reseau
84    [nets(n,i).W1 nets(n,i).W2]=MLPfit(base_val_n(:,1:end-1),base_val_n(:,end),base_app_n(:,1:end-1), ...
85                                       base_app_n(:,end),nets(n,i).W1,nets(n,i).W2,'tah','lin',[1500,1e-6],[100,1]);
86
87
88    %Restitution du reseau
89  tau_nn=MLPval(base_val_n(:,1:end-1),nets(n,i).W1,nets(n,i).W2);
90
91  %Performance du reseau
92  delta=(decenred(base_val_n(:,end),moy(end),et(end)) - decenred(tau_nn,moy(end),et(end))).^2;
93  perf(n,i)=sqrt((1./length(delta))*sum(delta));
94
95  end %for i
96end %for n
Note: See TracBrowser for help on using the repository browser.