wolffd@0: function CPD = set_fields(CPD, varargin) wolffd@0: % SET_PARAMS Set the parameters (fields) for a gaussian_CPD object wolffd@0: % CPD = set_params(CPD, name/value pairs) wolffd@0: % wolffd@0: % The following optional arguments can be specified in the form of name/value pairs: wolffd@0: % wolffd@0: % mean - mu(:,i) is the mean given Q=i wolffd@0: % cov - Sigma(:,:,i) is the covariance given Q=i wolffd@0: % weights - W(:,:,i) is the regression matrix given Q=i wolffd@0: % cov_type - if 'diag', Sigma(:,:,i) is diagonal wolffd@0: % tied_cov - if 1, we constrain Sigma(:,:,i) to be the same for all i wolffd@0: % clamp_mean - if 1, we do not adjust mu(:,i) during learning wolffd@0: % clamp_cov - if 1, we do not adjust Sigma(:,:,i) during learning wolffd@0: % clamp_weights - if 1, we do not adjust W(:,:,i) during learning wolffd@0: % clamp - if 1, we do not adjust any params wolffd@0: % cov_prior_weight - weight given to I prior for estimating Sigma wolffd@0: % cov_prior_entropic - if 1, we also use an entropic prior for Sigma [0] wolffd@0: % wolffd@0: % e.g., CPD = set_params(CPD, 'mean', [0;0]) wolffd@0: wolffd@0: args = varargin; wolffd@0: nargs = length(args); wolffd@0: for i=1:2:nargs wolffd@0: switch args{i}, wolffd@0: case 'mean', CPD.mean = args{i+1}; wolffd@0: case 'cov', CPD.cov = args{i+1}; wolffd@0: case 'weights', CPD.weights = args{i+1}; wolffd@0: case 'cov_type', CPD.cov_type = args{i+1}; wolffd@0: %case 'tied_cov', CPD.tied_cov = strcmp(args{i+1}, 'yes'); wolffd@0: case 'tied_cov', CPD.tied_cov = args{i+1}; wolffd@0: case 'clamp_mean', CPD.clamped_mean = args{i+1}; wolffd@0: case 'clamp_cov', CPD.clamped_cov = args{i+1}; wolffd@0: case 'clamp_weights', CPD.clamped_weights = args{i+1}; wolffd@0: case 'clamp', clamp = args{i+1}; wolffd@0: CPD.clamped_mean = clamp; wolffd@0: CPD.clamped_cov = clamp; wolffd@0: CPD.clamped_weights = clamp; wolffd@0: case 'cov_prior_weight', CPD.cov_prior_weight = args{i+1}; wolffd@0: case 'cov_prior_entropic', CPD.cov_prior_entropic = args{i+1}; wolffd@0: otherwise, wolffd@0: error(['invalid argument name ' args{i}]); wolffd@0: end wolffd@0: end