Daniel@0: function CPD = maximize_params(CPD, temp) Daniel@0: % MAXIMIZE_PARAMS Find ML params of an MLP using Scaled Conjugated Gradient (SCG) Daniel@0: % CPD = maximize_params(CPD, temperature) Daniel@0: % temperature parameter is ignored Daniel@0: Daniel@0: if ~adjustable_CPD(CPD), return; end Daniel@0: options = foptions; Daniel@0: Daniel@0: % options(1) >= 0 means print an annoying message when the max. num. iter. is reached Daniel@0: if CPD.verbose Daniel@0: options(1) = 1; Daniel@0: else Daniel@0: options(1) = -1; Daniel@0: end Daniel@0: %options(1) = CPD.verbose; Daniel@0: Daniel@0: options(2) = CPD.wthresh; Daniel@0: options(3) = CPD.llthresh; Daniel@0: options(14) = CPD.max_iter; Daniel@0: Daniel@0: dpsz=length(CPD.mlp); Daniel@0: Daniel@0: for i=1:dpsz Daniel@0: mask=[]; Daniel@0: mask=find(CPD.eso_weights(:,:,i)>0); % for adapting the parameters we use only positive weighted example Daniel@0: if ~isempty(mask), Daniel@0: CPD.mlp{i} = netopt_weighted(CPD.mlp{i}, options, CPD.parent_vals(mask',:), CPD.self_vals(mask',:,i), CPD.eso_weights(mask',:,i), 'scg'); Daniel@0: Daniel@0: CPD.W1(:,:,i)=CPD.mlp{i}.w1; % update the parameters matrix Daniel@0: CPD.b1(i,:)=CPD.mlp{i}.b1; % Daniel@0: CPD.W2(:,:,i)=CPD.mlp{i}.w2; % update the parameters matrix Daniel@0: CPD.b2(i,:)=CPD.mlp{i}.b2; % Daniel@0: end Daniel@0: end