annotate toolboxes/FullBNT-1.0.7/bnt/CPDs/@gaussian_CPD/set_fields.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 CPD = set_fields(CPD, varargin)
wolffd@0 2 % SET_PARAMS Set the parameters (fields) for a gaussian_CPD object
wolffd@0 3 % CPD = set_params(CPD, 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 %
wolffd@0 7 % mean - mu(:,i) is the mean given Q=i
wolffd@0 8 % cov - Sigma(:,:,i) is the covariance given Q=i
wolffd@0 9 % weights - W(:,:,i) is the regression matrix given Q=i
wolffd@0 10 % cov_type - if 'diag', Sigma(:,:,i) is diagonal
wolffd@0 11 % tied_cov - if 1, we constrain Sigma(:,:,i) to be the same for all i
wolffd@0 12 % clamp_mean - if 1, we do not adjust mu(:,i) during learning
wolffd@0 13 % clamp_cov - if 1, we do not adjust Sigma(:,:,i) during learning
wolffd@0 14 % clamp_weights - if 1, we do not adjust W(:,:,i) during learning
wolffd@0 15 % clamp - if 1, we do not adjust any params
wolffd@0 16 % cov_prior_weight - weight given to I prior for estimating Sigma
wolffd@0 17 % cov_prior_entropic - if 1, we also use an entropic prior for Sigma [0]
wolffd@0 18 %
wolffd@0 19 % e.g., CPD = set_params(CPD, 'mean', [0;0])
wolffd@0 20
wolffd@0 21 args = varargin;
wolffd@0 22 nargs = length(args);
wolffd@0 23 for i=1:2:nargs
wolffd@0 24 switch args{i},
wolffd@0 25 case 'mean', CPD.mean = args{i+1};
wolffd@0 26 case 'cov', CPD.cov = args{i+1};
wolffd@0 27 case 'weights', CPD.weights = args{i+1};
wolffd@0 28 case 'cov_type', CPD.cov_type = args{i+1};
wolffd@0 29 %case 'tied_cov', CPD.tied_cov = strcmp(args{i+1}, 'yes');
wolffd@0 30 case 'tied_cov', CPD.tied_cov = args{i+1};
wolffd@0 31 case 'clamp_mean', CPD.clamped_mean = args{i+1};
wolffd@0 32 case 'clamp_cov', CPD.clamped_cov = args{i+1};
wolffd@0 33 case 'clamp_weights', CPD.clamped_weights = args{i+1};
wolffd@0 34 case 'clamp', clamp = args{i+1};
wolffd@0 35 CPD.clamped_mean = clamp;
wolffd@0 36 CPD.clamped_cov = clamp;
wolffd@0 37 CPD.clamped_weights = clamp;
wolffd@0 38 case 'cov_prior_weight', CPD.cov_prior_weight = args{i+1};
wolffd@0 39 case 'cov_prior_entropic', CPD.cov_prior_entropic = args{i+1};
wolffd@0 40 otherwise,
wolffd@0 41 error(['invalid argument name ' args{i}]);
wolffd@0 42 end
wolffd@0 43 end