annotate toolboxes/FullBNT-1.0.7/bnt/examples/static/HME/hme_reg_plot.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function fh=hme_reg_plot(net, nodes_info, train_data, test_data)
wolffd@0 2 %
wolffd@0 3 % Use this function ONLY when the input dimension is 1
wolffd@0 4 % and the problem is a regression one.
wolffd@0 5 % We assume that each row of 'train_data' & 'test_data' is an example.
wolffd@0 6 %
wolffd@0 7 % ----------------------------------------------------------------------------------------------------
wolffd@0 8 % -> pierpaolo_b@hotmail.com or -> pampo@interfree.it
wolffd@0 9 % ----------------------------------------------------------------------------------------------------
wolffd@0 10
wolffd@0 11 fh=figure('Name','HME based regression', 'MenuBar', 'none', 'NumberTitle', 'off');
wolffd@0 12
wolffd@0 13 mn_x_train = round(min(train_data(:,1)));
wolffd@0 14 mx_x_train = round(max(train_data(:,1)));
wolffd@0 15 x_train = mn_x_train(1):0.01:mx_x_train(1);
wolffd@0 16 Z_train=fhme(net, nodes_info, x_train',size(x_train,2)); % forward propagation trougth the HME
wolffd@0 17
wolffd@0 18 if nargin==4,
wolffd@0 19 subplot(2,1,1);
wolffd@0 20 mn_x_test = round(min(test_data(:,1)));
wolffd@0 21 mx_x_test = round(max(test_data(:,1)));
wolffd@0 22 x_test = mn_x_test(1):0.01:mx_x_test(1);
wolffd@0 23 Z_test=fhme(net, nodes_info, x_test',size(x_test,2)); % forward propagation trougth the HME
wolffd@0 24 end
wolffd@0 25
wolffd@0 26 hold on;
wolffd@0 27 set(gca, 'Box', 'on');
wolffd@0 28 plot(x_train', Z_train, 'r');
wolffd@0 29 plot(train_data(:,1),train_data(:,2),'+k');
wolffd@0 30 title('Training set and prediction');
wolffd@0 31 hold off
wolffd@0 32
wolffd@0 33 if nargin==4,
wolffd@0 34 subplot(2,1,2);
wolffd@0 35 hold on;
wolffd@0 36 set(gca, 'Box', 'on');
wolffd@0 37 plot(x_train', Z_train, 'r');
wolffd@0 38 if size(test_data,2)==2,
wolffd@0 39 plot(test_data(:,1),test_data(:,2),'+k');
wolffd@0 40 end
wolffd@0 41 title('Test set and prediction');
wolffd@0 42 hold off
wolffd@0 43 end