Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0
(1,469 bytes)
function [ forests ] = NicForest_develop(xtrain,ytrain,opt)
%NICFOREST_DEVELOP Develop forest on data set with automatic setting of parameters
% [ ] = NicForest_develop()
%
%
% Inputs:
%
%
%
% Outputs:
%
%
%
% Example
% [ ] = NicForest_develop()
%
% See also FCN1
% $LastChangedBy: alistair $
% $LastChangedDate: 2012-06-01 13:25:19 +0100 (Fri, 01 Jun 2012) $
% $Revision: 24 $
% Originally written on GLNXA64 by Alistair Johnson, 11-May-2012 15:13:19
% Contact: alistairewj@gmail.com
% SPECIFIED PARAMETERS FOR FOREST
if nargin<3
opt=forest_opt_set;
else
opt = forest_opt_set(opt);
end
% opt.Trees=500;
% opt.Iterations=20000; % number of Iterations for each MCMC repetition
% opt.Save=2e3; % Save forest every MCCsave
% opt.Resets=1; % Number of reset during MCCres iterations
% opt.UpdatedTrees = 2;
%=== Determine method: regression or classification
if isempty(opt.Family)
num_tar = numel(unique(ytrain));
if num_tar==1
error('Only one class provided');
elseif num_tar==2
opt.Family = 'binomial';
else
opt.Family = 'normal';
end
end
%=== Calculate a good width value
if isempty(opt.Width)
opt.Width = NicForest_CalculateWidth(xtrain,ytrain,opt);
end
fprintf('width = %g\n',opt.Width);
if ~isempty(opt.Group) && isempty(opt.GroupPower)
[ pwr ] = NicForest_CalculateGroupPower(xtrain,ytrain,opt);
opt.GroupPower = pwr;
end
[ forests ] = NicForest_train(xtrain,ytrain,opt);
end