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

📄 mixexp3.m

📁 基于贝叶斯网络的源程序
💻 M
字号:
% Fit a piece-wise linear regression model.% Here is the model%%  X \%  | |%  Q |%  | /%  Y%% where all arcs point down.% We condition everything on X, so X is a root node. Q is a softmax, and Y is a linear Gaussian.% Q is hidden, X and Y are observed.X = 1;Q = 2;Y = 3;dag = zeros(3,3);dag(X,[Q Y]) = 1;dag(Q,Y) = 1;ns = [1 2 1]; % make X and Y scalars, and have 2 expertsdnodes = [2];onodes = [1 3];bnet = mk_bnet(dag, ns, 'discrete', dnodes, 'observed', onodes);IRLS_iter = 10;clamped = 0;bnet.CPD{1} = root_CPD(bnet, 1);% start with good initial paramsw = [-5 5];  % w(:,i) is the normal vector to the i'th decisions boundaryb = [0 0];  % b(i) is the offset (bias) to the i'th decisions boundarymu = [0 0];sigma = 1;Sigma = repmat(sigma*eye(ns(Y)), [ns(Y) ns(Y) ns(Q)]);W = [-1 1];W2 = reshape(W, [ns(Y) ns(X) ns(Q)]);bnet.CPD{2} = softmax_CPD(bnet, 2, w, b,  clamped, IRLS_iter);bnet.CPD{3} = gaussian_CPD(bnet, 3, 'mean', mu, 'cov', Sigma, 'weights', W2);engine = jtree_inf_engine(bnet);evidence = cell(1,3);evidence{X} = 0.68;engine = enter_evidence(engine, evidence);m = marginal_nodes(engine, Y);m.mu

⌨️ 快捷键说明

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