diff toolboxes/FullBNT-1.0.7/bnt/examples/static/dtree/test_zoo1.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/FullBNT-1.0.7/bnt/examples/static/dtree/test_zoo1.m	Tue Feb 10 15:05:51 2015 +0000
@@ -0,0 +1,21 @@
+% Here the training data is adapted from UCI ML repository, 'zoo' data
+
+dtreeCPD=tree_CPD;
+
+% load data
+fname = fullfile(BNT_HOME, 'examples', 'static', 'uci_data', 'zoo', 'zoo1.data')
+data=load(fname);
+data=data';
+
+data=transform_data_into_bnt_format(data, []);
+
+% learn decision tree from data 
+ns=2*ones(1,17);
+ns(13)=6;
+ns(17)=7;
+dtreeCPD1=learn_params(dtreeCPD,1:17,data,ns,[],'stop_cases',5); % a node with less than 5 cases will not be splitted
+
+% evaluate on data
+[score,outputs]=evaluate_tree_performance(dtreeCPD1,1:17,data,ns,[]);
+fprintf('Accuracy in old training data %6.3f\n',score);
+