determine_pot_type.m

来自「贝叶斯网络的算法」· M 代码 · 共 26 行

M
26
字号
function pot_type = determine_pot_type(model, onodes, nodes)% DETERMINE_POT_TYPE Determine the type of potential based on the evidence pattern.% pot_type = determine_pot_type(model, onodes, nodes)%% If there are any utility nodes, pot_type = 'u'% else% If all hidden nodes are discrete, pot_type = 'd'.% If all hidden nodes are continuous, pot_type = 'g' (Gaussian).% If some hidden nodes are discrete, and some cts, pot_type = 'cg' (conditional Gaussian).%% nodes defaults to all nodes in graphnnodes = length(model.node_sizes);if nargin < 3, nodes = 1:nnodes; endhnodes = mysetdiff(nodes, onodes);if isfield(model, 'limid') %~isempty(model.utility_nodes)  pot_type = 'u';elseif isempty(myintersect(model.cnodes, hnodes))  pot_type = 'd';elseif mysubset(hnodes, model.cnodes)  pot_type = 'g';else  pot_type = 'cg';end

⌨️ 快捷键说明

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