Mercurial > hg > camir-ismir2012
annotate toolboxes/FullBNT-1.0.7/bnt/examples/static/dtree/test_zoo1.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
rev | line source |
---|---|
Daniel@0 | 1 % Here the training data is adapted from UCI ML repository, 'zoo' data |
Daniel@0 | 2 |
Daniel@0 | 3 dtreeCPD=tree_CPD; |
Daniel@0 | 4 |
Daniel@0 | 5 % load data |
Daniel@0 | 6 fname = fullfile(BNT_HOME, 'examples', 'static', 'uci_data', 'zoo', 'zoo1.data') |
Daniel@0 | 7 data=load(fname); |
Daniel@0 | 8 data=data'; |
Daniel@0 | 9 |
Daniel@0 | 10 data=transform_data_into_bnt_format(data, []); |
Daniel@0 | 11 |
Daniel@0 | 12 % learn decision tree from data |
Daniel@0 | 13 ns=2*ones(1,17); |
Daniel@0 | 14 ns(13)=6; |
Daniel@0 | 15 ns(17)=7; |
Daniel@0 | 16 dtreeCPD1=learn_params(dtreeCPD,1:17,data,ns,[],'stop_cases',5); % a node with less than 5 cases will not be splitted |
Daniel@0 | 17 |
Daniel@0 | 18 % evaluate on data |
Daniel@0 | 19 [score,outputs]=evaluate_tree_performance(dtreeCPD1,1:17,data,ns,[]); |
Daniel@0 | 20 fprintf('Accuracy in old training data %6.3f\n',score); |
Daniel@0 | 21 |