log_marg_prob_node_case.m
来自「基于matlab的bayes net toolbox,希望对大家能有些帮助」· M 代码 · 共 23 行
M
23 行
function L = log_marg_prob_node_case(CPD, y, x)% LOG_MARG_PROB_NODE_CASE Compute prod_m log P(x(i,m)| x(pi_i,m)) for node i (tabular)% L = log_marg_prob_node_case(CPD, self_ev, parent_ev)% % This is a slightly optimised version of log_marg_prob_node.% We assume we have exactly 1 case, i.e., y is a scalar and x is a vector (not a cell array).sz = CPD.sizes;nparents = length(sz)-1;% We assume the CPTs are already set to the mean of the posterior (due to update_params)switch nparents case 0, p = CPD.CPT(y); case 1, p = CPD.CPT(x(1), y); case 2, p = CPD.CPT(x(1), x(2), y); case 3, p = CPD.CPT(x(1), x(2), x(3), y); otherwise, ind = subv2ind(sz, [x y]); p = CPD.CPT(ind);endL = log(p);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?