wolffd@0: function fh=hme_reg_plot(net, nodes_info, train_data, test_data) wolffd@0: % wolffd@0: % Use this function ONLY when the input dimension is 1 wolffd@0: % and the problem is a regression one. wolffd@0: % We assume that each row of 'train_data' & 'test_data' is an example. wolffd@0: % wolffd@0: % ---------------------------------------------------------------------------------------------------- wolffd@0: % -> pierpaolo_b@hotmail.com or -> pampo@interfree.it wolffd@0: % ---------------------------------------------------------------------------------------------------- wolffd@0: wolffd@0: fh=figure('Name','HME based regression', 'MenuBar', 'none', 'NumberTitle', 'off'); wolffd@0: wolffd@0: mn_x_train = round(min(train_data(:,1))); wolffd@0: mx_x_train = round(max(train_data(:,1))); wolffd@0: x_train = mn_x_train(1):0.01:mx_x_train(1); wolffd@0: Z_train=fhme(net, nodes_info, x_train',size(x_train,2)); % forward propagation trougth the HME wolffd@0: wolffd@0: if nargin==4, wolffd@0: subplot(2,1,1); wolffd@0: mn_x_test = round(min(test_data(:,1))); wolffd@0: mx_x_test = round(max(test_data(:,1))); wolffd@0: x_test = mn_x_test(1):0.01:mx_x_test(1); wolffd@0: Z_test=fhme(net, nodes_info, x_test',size(x_test,2)); % forward propagation trougth the HME wolffd@0: end wolffd@0: wolffd@0: hold on; wolffd@0: set(gca, 'Box', 'on'); wolffd@0: plot(x_train', Z_train, 'r'); wolffd@0: plot(train_data(:,1),train_data(:,2),'+k'); wolffd@0: title('Training set and prediction'); wolffd@0: hold off wolffd@0: wolffd@0: if nargin==4, wolffd@0: subplot(2,1,2); wolffd@0: hold on; wolffd@0: set(gca, 'Box', 'on'); wolffd@0: plot(x_train', Z_train, 'r'); wolffd@0: if size(test_data,2)==2, wolffd@0: plot(test_data(:,1),test_data(:,2),'+k'); wolffd@0: end wolffd@0: title('Test set and prediction'); wolffd@0: hold off wolffd@0: end