rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
hp_plot_domain_full.m
1 function matrix = hp_plot_domain_full(hp_model)
2 tree = set_color(hp_model.tree);
3 
4 detail = 300;
5 matrix=zeros(detail,detail,3);
6 for i = 1:detail
7  for n = 1:detail
8 
9 
10  c= getcolor(tree,[i/detail;n/detail;]);
11  matrix(n,i,:) = c;
12 
13  end;
14 end;
15 
16  imagesc(0:1,0:1,matrix);
17 axis xy;
18  function c=getcolor(tree,param)
19  t = iscell(tree);
20  % if the given tree is a tree (and not an array)
21  if t==1
22  %get representative parameters of the two sub-trees
23  first_l=tree_first(tree{1});
24  first_r=tree_first(tree{2});
25  % calculate the distances for tree navigation using the
26  % euclidnorm
27  if hp_model.error_distance_extionsion ==1
28 
29  distance_l = hp_model.distance_function(first_l.model,first_l.anchor,param,...
30  first_l.detailed_data,first_l.reduced_data);%norm(first_l-param,2);
31  distance_r = hp_model.distance_function(first_r.model, first_r.anchor,param,...
32  first_r.detailed_data,first_r.reduced_data) ;%norm(first_r-param,2);
33 
34  else
35 
36  distance_l = hp_model.distance_function(first_l.model,first_l.anchor,param);%norm(first_l-param,2);
37  distance_r = hp_model.distance_function(first_r.model, first_r.anchor,param);%norm(first_r-param,2);
38 
39  end
40  % decide which subtree to follow and start recursion
41  if distance_l<distance_r
42  c = getcolor(tree{1},param);
43  else
44  c =getcolor(tree{2},param);
45  end;
46  % if the given tree is a array (algorithem arrived at the searched domain)
47  else
48  c=tree.color;
49  end;
50 
51  end
52 
53  function value= tree_first (test)
54  t= iscell(test);
55  if t==1
56  value=tree_first(test{1});
57  else
58  value=test;
59  end;
60 
61  end
62 
63  function tree_out = set_color( tree )
64  % function hp_plot_domains( tree )
65  % Funktion zum Zeichnen von Trainigsgebieten vom hp Bäumen (Bei 2d parameter)
66  t= iscell(tree);
67  % Naviagation durch den gesammten Baum
68  if t==1
69  tree{1}=set_color(tree{1});
70  tree{2}=set_color(tree{2});
71  tree_out = tree;
72  else
73  %Ausgabe des Traingssets in zufälliger Farbe
74 
75  tree_out = tree;
76  tree_out.color =rand_uniform(3,{[0.5 1]});
77 
78  end;
79  end
80 
81 
82 end