define_lin_pred_struct_sat.m

来自「The BNL toolbox is a set of Matlab funct」· M 代码 · 共 33 行

M
33
字号
function lin_pred_struct=define_lin_pred_struct_sat(equiv_class,parents)

%defines saturated model structure of the linear predictor for the CPTs 

%e.g. for two parents
    %0 refers to effects already included in pred_mat (main effects are included if not explicitly specified otherwise)
        %pred_mat is given by user, or is identity matrix 
    %1,... refer to parents (ordered)
     %lin_pred={1, 2}: linear predictor of the prob contains main effects of
    %parents, in addition to main effects of pred_mat
    %lin_pred={[0 2],1 }: main effects  of first parent,
    %variables in pred_mat have different effect for different values of second parent
    %lin_pred={[0 1], [0 2]}: 
    %variables in pred_mat have different effect for different values of first parent
    %variables in pred_mat have different effect for different values of second parent
    %lin_pred={[1 2]} :interaction effects of
    %parents, in addition to main effects of pred_mat
    %lin_pred={[0 1 2]}, free cond probs 
    %!! if 0 appears in an effect, it should be the first element !!
%structure of the linear predictor :
    %first all f0 vectors that contain 0, then all f0 vectors that contain no
    %within f0 and f1:
        %ordering according to order of nodenr:
        %last cell element 
        %corresponds to highest nodenumber (children). for interactions: lowest nodenr of
        %interactions counts

lin_pred_struct=cell(1,max(equiv_class));
for i=1:max(equiv_class)
    node_nr=find(equiv_class==i,1);
    s=length(parents{node_nr});
    lin_pred_struct{i}=0:s;
end

⌨️ 快捷键说明

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