about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m
diff options
context:
space:
mode:
authorziejd22017-09-28 15:04:40 -0500
committerziejd22017-09-28 15:04:40 -0500
commit8070dc963753142bb86c4ed698d91fd623ed28e7 (patch)
treed0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m
parent7cc31810d53176e805532b2789955f4eedbce6bb (diff)
downloadBNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning.

I am calling this BNW_1.02. It can be accessed at:
compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m')
-rw-r--r--sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m43
1 files changed, 43 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m b/sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m
new file mode 100644
index 00000000..510e96c2
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/examples/static/HME/hme_reg_plot.m
@@ -0,0 +1,43 @@
+function fh=hme_reg_plot(net, nodes_info, train_data, test_data)
+% 
+% Use this function ONLY when the input dimension is 1
+% and the problem is a regression one.
+% We assume that each row of 'train_data' & 'test_data' is an example.
+%
+% ----------------------------------------------------------------------------------------------------
+% -> pierpaolo_b@hotmail.com   or   -> pampo@interfree.it
+% ----------------------------------------------------------------------------------------------------
+
+fh=figure('Name','HME based regression', 'MenuBar', 'none', 'NumberTitle', 'off');
+
+mn_x_train = round(min(train_data(:,1)));
+mx_x_train = round(max(train_data(:,1)));     
+x_train = mn_x_train(1):0.01:mx_x_train(1);
+Z_train=fhme(net, nodes_info, x_train',size(x_train,2));      % forward propagation trougth the HME
+
+if nargin==4,
+    subplot(2,1,1);
+    mn_x_test = round(min(test_data(:,1)));
+    mx_x_test = round(max(test_data(:,1)));
+    x_test = mn_x_test(1):0.01:mx_x_test(1);
+    Z_test=fhme(net, nodes_info, x_test',size(x_test,2));      % forward propagation trougth the HME
+end
+
+hold on;
+set(gca, 'Box', 'on');
+plot(x_train', Z_train, 'r');
+plot(train_data(:,1),train_data(:,2),'+k');
+title('Training set and prediction');
+hold off
+
+if nargin==4,
+    subplot(2,1,2);
+    hold on;
+    set(gca, 'Box', 'on');
+    plot(x_train', Z_train, 'r');
+    if size(test_data,2)==2,
+        plot(test_data(:,1),test_data(:,2),'+k');
+    end
+    title('Test set and prediction');
+    hold off
+end
\ No newline at end of file