Aug 17, 2009

fullBNT

对于 supervised learning, 建立 bnt 时可以将 x, y 都定为 observed nodes。学习好后,inference 时不受影响?

创建 CPD 时,如果没有指定值,则为随机值。

Currently for continuous variables, only Gaussian CPD can be used.
gaussian_CPD (Y, X continuous, Q discrete. Q indexing which Gaussian Y is drawn from)

 Q  X
  |  /
  Y


Y|X=x,Q=i ~ N(mu(:,i) + W(:,:,i) * x, Sigma(:,:,i))
So the parameters are mu, Weights, Sigma
mu is a [|Y| |Q|] vector, Sigma has a size of [|Y| |Y| |Q|], ie, positive
semi-definite matrices indexed by Q, and W is a [|Y| |X| |Q|], ie, regression (weight)
matrices indexed by Q.
% mean       - mu(:,i) is the mean given Q=i [ randn(Y,Q) ]
% cov        - Sigma(:,:,i) is the covariance given Q=i [ repmat(100*eye(Y,Y), [1 1 Q]) ]
% weights    - W(:,:,i) is the regression matrix given Q=i [ randn(Y,X,Q) ]
% cov_type   - if 'diag', Sigma(:,:,i) is diagonal [ 'full' ]
% tied_cov 指相等的 - if 1, we constrain Sigma(:,:,i) to be the same for all i [0]
% clamp_mean - if 1, we do not adjust mu(:,i) during learning [0]确定的,可以设为 clamp
% clamp_cov  - if 1, we do not adjust Sigma(:,:,i) during learning [0]
% clamp_weights - if 1, we do not adjust W(:,:,i) during learning [0]
% cov_prior_weight - 不理解 weight given to I prior for estimating Sigma [0.01]
% cov_prior_entropic - if 1, we also use an entropic prior for Sigma [0]


1. 构建
mk_bnet (Bayesian Networks)
mk_dbn (dynamic Bayesian networks)
mk_limid (limited information influence diagram, what is this?)

2. define CPD
  • If you do not specify the value, random value is used.
  • Use root_CPD to attach pure input (always observed x in supervised learning. If you want to sample from the networks, you should provide x in advance) 
  • You can apply some constraints to the CPD, e.g., diagonal matrix for the covariance matrix
  • For known CPD (known as prior), you should disallow it to change during learning
3. Engine
4. Sample. You can sample from the bnet and dbn to get training data.
  • sample_bnet
  • sample_dbn
 You can use parameter 'evidence' to specify initial value for observed nodes, and sample other unknown nodes
5. Learning
When there are missing data, use em
  • learn_params_em
  • learn_params_dbn_em
otherwise, use non-em version
  • learn_params
  • learn_params_dbn
6. Marginalisation
First use enter_evidence to specify observed nodes, and then use marginal_nodes.

0 comments: