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