annotate toolboxes/FullBNT-1.0.7/bnt/potentials/determine_pot_type.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function pot_type = determine_pot_type(model, onodes, nodes)
wolffd@0 2 % DETERMINE_POT_TYPE Determine the type of potential based on the evidence pattern.
wolffd@0 3 % pot_type = determine_pot_type(model, onodes, nodes)
wolffd@0 4 %
wolffd@0 5 % If there are any utility nodes, pot_type = 'u'
wolffd@0 6 % else
wolffd@0 7 % If all hidden nodes are discrete, pot_type = 'd'.
wolffd@0 8 % If all hidden nodes are continuous, pot_type = 'g' (Gaussian).
wolffd@0 9 % If some hidden nodes are discrete, and some cts, pot_type = 'cg' (conditional Gaussian).
wolffd@0 10 %
wolffd@0 11 % nodes defaults to all nodes in graph
wolffd@0 12
wolffd@0 13 nnodes = length(model.node_sizes);
wolffd@0 14 if nargin < 3, nodes = 1:nnodes; end
wolffd@0 15
wolffd@0 16 hnodes = mysetdiff(nodes, onodes);
wolffd@0 17 if isfield(model, 'limid') %~isempty(model.utility_nodes)
wolffd@0 18 pot_type = 'u';
wolffd@0 19 elseif isempty(myintersect(model.cnodes, hnodes))
wolffd@0 20 pot_type = 'd';
wolffd@0 21 elseif mysubset(hnodes, model.cnodes)
wolffd@0 22 pot_type = 'g';
wolffd@0 23 else
wolffd@0 24 pot_type = 'cg';
wolffd@0 25 end