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