From 8070dc963753142bb86c4ed698d91fd623ed28e7 Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 28 Sep 2017 15:04:40 -0500 Subject: 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 --- sourcecodes/bnt-master/SLP/misc/export_cases.m | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sourcecodes/bnt-master/SLP/misc/export_cases.m (limited to 'sourcecodes/bnt-master/SLP/misc/export_cases.m') diff --git a/sourcecodes/bnt-master/SLP/misc/export_cases.m b/sourcecodes/bnt-master/SLP/misc/export_cases.m new file mode 100644 index 00000000..4ab0d790 --- /dev/null +++ b/sourcecodes/bnt-master/SLP/misc/export_cases.m @@ -0,0 +1,57 @@ +function S = export_cases(data, names, file, misv) +% filepath = export_cases(data, names, 'filename', missing_value) +% filename and missing_value [default [] if iscell(data) or -9999 if not] are optional +% +% Exports BNT datasets to Netica cases (* for missing data) +% +% Written by Francois.Olivier.C.H@gmail.com +% +% Informations could be found here http://www.norsys.com/downloads/ +% +% version 80807 + +% inits +if nargin==1, file=['dnet' datestr(now,'-yymmdd-HHMMSS')]; end +if nargin<2, error('Variable Names needed'); end +if length(file)>5, + if prod(double(file((end-3):end)~='.cas')), file=[file '.cas']; end + name = file(1:end-5); +else + name = file; + file = [file '.cas']; +end +if nargin<4, misv=-9999; end +if iscell(data), data = bnt_to_mat(data,misv); end + +[N m]=size(data); +if length(names)~=N, error('Sizes must be the same'); end + +% header of the file +fid = fopen(file, 'w'); +fprintf(fid, '// exported from the Bayes Net Toolbox with export_cases function \n'); +fprintf(fid, '// please report bugs to francois.olivier.c.h@gmail.com\n\n'); + +% write names +for i=1:N + fprintf(fid, '%s\t',names{i}); +end + +% exports +for l=1:m, + fprintf(fid, '\n'); + for i=1:N, + if data(i,l)~=misv, + fprintf(fid, '%s',['x' num2str(data(i,l))]); + else + fprintf(fid, '%s','*'); + end + if i