source: trunk/toolbox/MLPinit.m @ 35

Last change on this file since 35 was 2, checked in by pinsard, 15 years ago

first commit with original work of Julien Brajard

File size: 1.1 KB
Line 
1 function [W1,W2]=MLPinit(Xi,Yi,m)
2
3%MLPinit initializes weight matrices for a MLP
4
5%
6
7%       [W1,W2]=MLPinit(Xi,Yi,m)
8
9%
10
11% Xi the learning set input data
12
13% Yi the learning set output data
14
15% m the number of hidden unit of the MLP
16
17%
18
19% The function returns [W1,W2] the modified weights.
20
21%
22
23%       21/04/97 S. Canu, modified on Nov. 15th, 1999. (Evry, France)
24
25
26
27if nargin < 3;
28
29   help MLPinit
30
31   error(sprintf('\n *** MLPinit error: invalid call***\n\n\t[W1,W2]=MLPinit(Xi,Yi,m);\n\n'));
32
33end;
34
35
36
37[n,d]   = size(Xi);
38
39[n,q]   = size(Yi);
40
41
42
43
44
45%W1 = k1*randn(d+1,m);
46
47Xmax=max(Xi);           %modified on Nov. 15th, 1999
48
49Xmin=min(Xi);
50%W1(d+1,:) = (Xmax-Xmin)*(rand(1,m)-0.5)+(Xmax+Xmin)/2; %%%modifier locean le 18/avril2008
51
52W1(d+1,:) = (Xmax-Xmin)*(rand(d,m)-0.5)+(Xmax+Xmin)*ones(d,m)/(2*d); %%%%actualiser ici 18/avril2008
53
54W1(1:d,:) = 10*randn(d,m);                                      %
55
56
57
58W2 = 0.1*randn(m+1,q);
59
60
61W2(m+1,:) = mean(Yi);
62
63
64
65if max(max(abs(Xi))) > 10
66
67        disp('Warning*** Input data may be too high - use normalized data')
68
69end
70
71
72
73if max(max(abs(Yi))) > 10
74
75        disp('Warning*** Output data may be too high - use normalized data')
76
77end
78
79
80
81
Note: See TracBrowser for help on using the repository browser.