Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/netlab3.3/mlpinit.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function net = mlpinit(net, prior) | |
2 %MLPINIT Initialise the weights in a 2-layer feedforward network. | |
3 % | |
4 % Description | |
5 % | |
6 % NET = MLPINIT(NET, PRIOR) takes a 2-layer feedforward network NET and | |
7 % sets the weights and biases by sampling from a Gaussian distribution. | |
8 % If PRIOR is a scalar, then all of the parameters (weights and biases) | |
9 % are sampled from a single isotropic Gaussian with inverse variance | |
10 % equal to PRIOR. If PRIOR is a data structure of the kind generated by | |
11 % MLPPRIOR, then the parameters are sampled from multiple Gaussians | |
12 % according to their groupings (defined by the INDEX field) with | |
13 % corresponding variances (defined by the ALPHA field). | |
14 % | |
15 % See also | |
16 % MLP, MLPPRIOR, MLPPAK, MLPUNPAK | |
17 % | |
18 | |
19 % Copyright (c) Ian T Nabney (1996-2001) | |
20 | |
21 if isstruct(prior) | |
22 sig = 1./sqrt(prior.index*prior.alpha); | |
23 w = sig'.*randn(1, net.nwts); | |
24 elseif size(prior) == [1 1] | |
25 w = randn(1, net.nwts).*sqrt(1/prior); | |
26 else | |
27 error('prior must be a scalar or a structure'); | |
28 end | |
29 | |
30 net = mlpunpak(net, w); | |
31 |