comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function engine = set_params(engine, varargin)
2 % SET_PARAMS Set the parameters (fields) for a belprop_inf_engine object
3 % engine = set_params(engine, name/value pairs)
4 %
5 % The following optional arguments can be specified in the form of name/value pairs:
6 % e.g., engine = set_params(engine, 'tol', 1e-2, 'max_iter', 10)
7 %
8 % max_iter - max. num. loopy iterations
9 % momentum - weight assigned to old message in convex combination
10 % tol - tolerance used to assess convergence
11 % maximize - 1 means use max-product, 0 means use sum-product
12
13 args = varargin{1};
14 nargs = length(args);
15 for i=1:2:nargs
16 switch args{i},
17 case 'max_iter', engine.max_iter = args{i+1};
18 case 'momentum', engine.momentum = args{i+1};
19 case 'tol', engine.tol = args{i+1};
20 case 'maximize', engine.maximize = args{i+1};
21 otherwise,
22 error(['invalid argument name ' args{i}]);
23 end
24 end