A demonstration of the ROAD method
The Regularized Optimal Affine Discriminant (ROAD) is a high-dimensional classification method, which was proposed by Fan et al. (2012)(pdf link). Currently, the code handles binary classifications, but extensions to multi-class will be available later. The following example illustrates how to apply ROAD.
Contents
Setting up the parameters
p = 1000; % number of variables n = 300; % number of observations s0 = 10; % number of nonzero mean differences rho = 0.5; % pairwise correlation coefficient randSeed = 1; % setup the random seed to let the program repeatable
Generate data
First, we generate the means and the common covariance matrix for the two classes. Then, we generate the training and testing data from the true multivariate guassian distributions.
mu1 = zeros(p,1); mu2 = zeros(p,1); mu2(1:s0) = 1; Sigma = eqcor(p,rho); rand('state', randSeed); randn('state',randSeed); nTrain = n; nTest = n; Y1Train = mvnrnd(repmat(mu1',nTrain,1),Sigma); Y2Train = mvnrnd(repmat(mu2',nTrain,1),Sigma); Y1Test = mvnrnd(repmat(mu1',nTest,1),Sigma); Y2Test = mvnrnd(repmat(mu2',nTest,1),Sigma); x = [Y1Train;Y2Train]; y = [zeros(n,1);ones(n,1)]; xtest = [Y1Test;Y2Test]; ytest = [zeros(n,1);ones(n,1)];
Test the ROAD method
Here we test the ROAD and screening-based versions S-ROAD1 and S-ROAD2. In the roadBatch function, the second to last parameter represents whether we use a diagonal-based version (0=no, 1=yes), and the last parameter represents whether we use a screening-based version (0=no, 1=1st version, 2=2nd version).
[ROADfit] = roadBatch(x, y, xtest, ytest, 0, 0) % ROAD [sROAD1fit] = roadBatch(x, y, xtest, ytest, 0, 1) % Screening-based ROAD version 1 (S-ROAD1) [sROAD2fit] = roadBatch(x, y, xtest, ytest, 0, 2) % Screening-based ROAD version 2 (S-ROAD2)