%NICFOREST Main function demoing how to use the toolbox. % $LastChangedBy: alistair $ % $LastChangedDate: 2012-05-30 12:21:30 +0100 (Wed, 30 May 2012) $ % $Revision: 21 $ % Originally written on GLNXA64 by Alistair Johnson, 09-May-2012 16:26:13 % Contact: alistairewj@gmail.com % clear,clc; %=== PHYSIONET DATA % load PhysionetDataSetA % xtrain=data(1:3000,:); % ytrain=outcome(1:3000); % xtest=data(3001:end,:); % ytest=outcome(3001:end); %=== qiao's data load qiao.mat gtrain = xtrain(:,1); % groupings gtest = xtest(:,1); xtrain=xtrain(:,2:end); xtest=xtest(:,2:end); % %=== air quality data (regression) % load air % xtrain=data(1:100,:); % ytrain=outcome(1:100); % xtest=data(101:end,:); % ytest=outcome(101:end); %=== Randomize seed RandStream.setDefaultStream(RandStream('mt19937ar','seed',100)); %% Train the forest opt = forest_opt_set('Iterations', 100000, ... 'Resets', 2,... 'Width',0.2,... 'Group',gtrain); [ f_out ] = NicForest_develop(xtrain,ytrain,opt); % save('f_out.mat','forests'); %% Test ypred = NicForest_apply(f_out , xtest ); %% Evaluate perf. % if strcmp(opt.Family,'binomial') fprintf('Log likelihood of test data: %g.\n',sum(-ytest.*log(ypred)-(1-ytest).*log(1-ypred))); stat_calc_struct(ypred,ytest) % end