blob: c09485661058830b0892cdd2839e72bffc22d934 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
function CPD = learn_params_orig(CPD,j,data,ns,cnodes)
% LEARN_PARAMS_ORIG
% Calculate the original distributions of the data.
% The original distributions are just the percentages of states in the
% data file.
local_data = data(j, :);
nobs = size(local_data,2);
if iscell(local_data)
local_data = cell2num(local_data);
end
counts = compute_counts(local_data,ns(j));
counts = counts/nobs;
switch CPD.prior_type
case 'none', CPD.CPT_orig = counts;
% case 'dirichlet', CPD.CPT = mk_stochastic(counts + CPD.dirichlet);
% I will use 'dirichlet' priors incorrectly here.
case 'dirichlet', CPD.CPT_orig = counts;
otherwise, error(['unrecognized prior ' CPD.prior_type])
end
|