define_lin_pred_struct_main.asv

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

ASV
37
字号
function lin_pred_struct=define_lin_pred_struct_main(equiv_class,parents)

%defines structure of the linear predictor for the CPTs when only main
%effects of parents are incorporated for each node

%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 THIS IS THE DEFAULT
    %!! 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(max(equiv_class),1);
for i=1:length(lin_pred_struct)
    
    a=cell(1,1+length(parents(i)));
    for k=0:length(parents(i))
        a(k+1)={k};
    end
lin_pred_struct(i)={a};
end

⌨️ 快捷键说明

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