%HEART 303 objects with 13 features in 2 classes
%
%       X = HEART
%
% Heart-Cleveland dataset from the Hungarian Institute of Cardiology.
% Budapest: Andras Janosi, M.D.
%
%       X = HEART(VAL)
%
% By default objects with missing values are removed. When something else
% is desired, use one of the options in MISVAL.
%
% SEE ALSO <a href="http://prtools.tudelft.nl/prtools/">PRTools Guide</a>, <a href="http://archive.ics.uci.edu/ml/">UCI Website</a>
% PRTOOLS, DATASETS, MISVAL

% Copyright: R.P.W. Duin 

function a = heart(val)

if nargin<1
	val = 'remove';
end
a = pr_loadmatfile;
if isempty(a)
  opt.labfeat   = 14;
  opt.featnames = {'age' 'sex' 'cp' 'trestbps' 'chol' 'fbs' 'restecg' ...
      'thalach' 'exang' 'oldpeak' 'slope' 'ca' 'thal'};
  opt.classnames = {'absent' 'present'  'present'  'present'  'present'};
	opt.desc='The Cleveland database from the Heart Disease Databases from UCI.  The class disease-presence is used as target class. ';
	opt.link = 'ftp://ftp.ics.uci.edu/pub/machine-learning-databases/heart-cleveland/';
  opt.dsetname = 'Heart Cleveland';
  a = pr_download('http://prtools.tudelft.nl/prdatasets/heart.dat',[],opt);
  nlab = getnlab(a);
  nlab(nlab>1) = 2;
  a = setnlab(a,nlab);
  a = remclass(a);
  fd = {[0 inf; 0 inf] [0 1] [1 2 3 4] [0 inf; 0 inf] [0 inf; 0 inf] ...
      [0 1] [0 1 2] [0 inf; 0 inf] [0 1] [0 inf; 0 inf] [1 2 3] [-1 0 1 2 3] [3 6 7]};
  x = setfeatdom(a,fd);
  pr_savematfile(a);
end
[a,msg] = misval(a,val);

return
