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

📄 enumerate_scenarios.m

📁 麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!
💻 M
字号:
function [scenarios, log_probs] = enumerate_scenarios(bnet, evidence)% ENUMERATE_SCENARIOS Enumerate all assignments, and return the prob. of the non-zeros ones% function [scenarios, log_probs] = enumerate_scenarios(bnet, evidence)assert(isempty(bnet.cnodes));n = length(bnet.dag);observed = ~isemptycell(evidence);vals = cat(1,evidence{observed});vals = vals(:)';ns = bnet.node_sizes;log_probs = [];scenarios = [];for i=1:prod(ns)  inst = ind2subv(ns, i); % i'th instantiation  if isempty(vals) | inst(observed) == vals % agrees with evidence    ll = log_lik_complete(bnet, num2cell(inst(:)));    log_probs = [log_probs ll];    scenarios = [scenarios(:)' inst];  endend

⌨️ 快捷键说明

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