⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 log_marg_prob_node_case.m

📁 贝叶斯网络的matlab实现。可以创建贝叶斯网络、训练模型
💻 M
字号:
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);
end
L = log(p);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -