To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _FullBNT / BNT / CPDs / @gaussian_CPD / set_fields.m @ 8:b5b38998ef3b
History | View | Annotate | Download (1.79 KB)
| 1 |
function CPD = set_fields(CPD, varargin) |
|---|---|
| 2 |
% SET_PARAMS Set the parameters (fields) for a gaussian_CPD object |
| 3 |
% CPD = set_params(CPD, name/value pairs) |
| 4 |
% |
| 5 |
% The following optional arguments can be specified in the form of name/value pairs: |
| 6 |
% |
| 7 |
% mean - mu(:,i) is the mean given Q=i |
| 8 |
% cov - Sigma(:,:,i) is the covariance given Q=i |
| 9 |
% weights - W(:,:,i) is the regression matrix given Q=i |
| 10 |
% cov_type - if 'diag', Sigma(:,:,i) is diagonal |
| 11 |
% tied_cov - if 1, we constrain Sigma(:,:,i) to be the same for all i |
| 12 |
% clamp_mean - if 1, we do not adjust mu(:,i) during learning |
| 13 |
% clamp_cov - if 1, we do not adjust Sigma(:,:,i) during learning |
| 14 |
% clamp_weights - if 1, we do not adjust W(:,:,i) during learning |
| 15 |
% clamp - if 1, we do not adjust any params |
| 16 |
% cov_prior_weight - weight given to I prior for estimating Sigma |
| 17 |
% cov_prior_entropic - if 1, we also use an entropic prior for Sigma [0] |
| 18 |
% |
| 19 |
% e.g., CPD = set_params(CPD, 'mean', [0;0]) |
| 20 |
|
| 21 |
args = varargin; |
| 22 |
nargs = length(args); |
| 23 |
for i=1:2:nargs |
| 24 |
switch args{i},
|
| 25 |
case 'mean', CPD.mean = args{i+1};
|
| 26 |
case 'cov', CPD.cov = args{i+1};
|
| 27 |
case 'weights', CPD.weights = args{i+1};
|
| 28 |
case 'cov_type', CPD.cov_type = args{i+1};
|
| 29 |
%case 'tied_cov', CPD.tied_cov = strcmp(args{i+1}, 'yes');
|
| 30 |
case 'tied_cov', CPD.tied_cov = args{i+1};
|
| 31 |
case 'clamp_mean', CPD.clamped_mean = args{i+1};
|
| 32 |
case 'clamp_cov', CPD.clamped_cov = args{i+1};
|
| 33 |
case 'clamp_weights', CPD.clamped_weights = args{i+1};
|
| 34 |
case 'clamp', clamp = args{i+1};
|
| 35 |
CPD.clamped_mean = clamp; |
| 36 |
CPD.clamped_cov = clamp; |
| 37 |
CPD.clamped_weights = clamp; |
| 38 |
case 'cov_prior_weight', CPD.cov_prior_weight = args{i+1};
|
| 39 |
case 'cov_prior_entropic', CPD.cov_prior_entropic = args{i+1};
|
| 40 |
otherwise, |
| 41 |
error(['invalid argument name ' args{i}]);
|
| 42 |
end |
| 43 |
end |