Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@mlp_CPD/maximize_params.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 CPD = maximize_params(CPD, temp) | |
2 % MAXIMIZE_PARAMS Find ML params of an MLP using Scaled Conjugated Gradient (SCG) | |
3 % CPD = maximize_params(CPD, temperature) | |
4 % temperature parameter is ignored | |
5 | |
6 if ~adjustable_CPD(CPD), return; end | |
7 options = foptions; | |
8 | |
9 % options(1) >= 0 means print an annoying message when the max. num. iter. is reached | |
10 if CPD.verbose | |
11 options(1) = 1; | |
12 else | |
13 options(1) = -1; | |
14 end | |
15 %options(1) = CPD.verbose; | |
16 | |
17 options(2) = CPD.wthresh; | |
18 options(3) = CPD.llthresh; | |
19 options(14) = CPD.max_iter; | |
20 | |
21 dpsz=length(CPD.mlp); | |
22 | |
23 for i=1:dpsz | |
24 mask=[]; | |
25 mask=find(CPD.eso_weights(:,:,i)>0); % for adapting the parameters we use only positive weighted example | |
26 if ~isempty(mask), | |
27 CPD.mlp{i} = netopt_weighted(CPD.mlp{i}, options, CPD.parent_vals(mask',:), CPD.self_vals(mask',:,i), CPD.eso_weights(mask',:,i), 'scg'); | |
28 | |
29 CPD.W1(:,:,i)=CPD.mlp{i}.w1; % update the parameters matrix | |
30 CPD.b1(i,:)=CPD.mlp{i}.b1; % | |
31 CPD.W2(:,:,i)=CPD.mlp{i}.w2; % update the parameters matrix | |
32 CPD.b2(i,:)=CPD.mlp{i}.b2; % | |
33 end | |
34 end |