comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@tree_CPD/tree_CPD.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function CPD = tree_CPD(varargin)
2 %DTREE_CPD Make a conditional prob. distrib. which is a decision/regression tree.
3 %
4 % CPD =dtree_CPD() will create an empty tree.
5
6 if nargin==0
7 % This occurs if we are trying to load an object from a file.
8 CPD = init_fields;
9 clamp = 0;
10 CPD = class(CPD, 'tree_CPD', discrete_CPD(clamp, []));
11 return;
12 elseif isa(varargin{1}, 'tree_CPD')
13 % This might occur if we are copying an object.
14 CPD = varargin{1};
15 return;
16 end
17
18 CPD = init_fields;
19
20
21 clamped = 0;
22 fam_sz = [];
23 CPD = class(CPD, 'tree_CPD', discrete_CPD(clamped, fam_sz));
24
25
26 %%%%%%%%%%%
27
28 function CPD = init_fields()
29 % This ensures we define the fields in the same order
30 % no matter whether we load an object from a file,
31 % or create it from scratch. (Matlab requires this.)
32
33 %init the decision tree set the root to null
34 CPD.tree.num_node = 0;
35 CPD.tree.root=1;
36 CPD.tree.nodes=[];
37