Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/inference/static/@belprop_fg_inf_engine/set_params.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function engine = set_params(engine, varargin) |
wolffd@0 | 2 % SET_PARAMS Set the parameters (fields) for a belprop_inf_engine object |
wolffd@0 | 3 % engine = set_params(engine, name/value pairs) |
wolffd@0 | 4 % |
wolffd@0 | 5 % The following optional arguments can be specified in the form of name/value pairs: |
wolffd@0 | 6 % e.g., engine = set_params(engine, 'tol', 1e-2, 'max_iter', 10) |
wolffd@0 | 7 % |
wolffd@0 | 8 % max_iter - max. num. loopy iterations |
wolffd@0 | 9 % momentum - weight assigned to old message in convex combination |
wolffd@0 | 10 % tol - tolerance used to assess convergence |
wolffd@0 | 11 % maximize - 1 means use max-product, 0 means use sum-product |
wolffd@0 | 12 |
wolffd@0 | 13 args = varargin{1}; |
wolffd@0 | 14 nargs = length(args); |
wolffd@0 | 15 for i=1:2:nargs |
wolffd@0 | 16 switch args{i}, |
wolffd@0 | 17 case 'max_iter', engine.max_iter = args{i+1}; |
wolffd@0 | 18 case 'momentum', engine.momentum = args{i+1}; |
wolffd@0 | 19 case 'tol', engine.tol = args{i+1}; |
wolffd@0 | 20 case 'maximize', engine.maximize = args{i+1}; |
wolffd@0 | 21 otherwise, |
wolffd@0 | 22 error(['invalid argument name ' args{i}]); |
wolffd@0 | 23 end |
wolffd@0 | 24 end |