# # Epage 126 # Epage 134 # # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- source("load_vowel_data.R") source("reduced_rank_LDA.R") out = load_vowel_data( FALSE, FALSE ) XTrain = out[[1]] yTrain = out[[2]] XTest = out[[3]] yTest = out[[4]] out = reduced_rank_LDA( XTrain, yTrain, XTest, yTest ) K = length(unique(yTrain)) # the number of classes (expect the classes to be labeled 1, 2, 3, ..., K-1, K XTProj = out[[1]] MSProj = out[[3]] #postscript("../../WriteUp/Graphics/Chapter4/dup_fig_4_4.eps", onefile=FALSE, horizontal=FALSE) plot_colors = c("black","blue","brown","purple","orange","cyan","gray","yellow","black","red","green") for( ci in 1:K ){ inds = yTrain == ci if( ci==1 ){ plot( XTProj[inds,1], XTProj[inds,2], xlab="Coordinate 1 for Training Data", ylab="Coordinate 2 for Training Data", col=plot_colors[ci], type="p", xlim=range(XTProj[,1]), ylim=range(XTProj[,2]) ) lines( MSProj[ci,1], MSProj[ci,2], col=plot_colors[ci], type="p", cex=10, pch="." ) }else{ lines( XTProj[inds,1], XTProj[inds,2], xlab="Coordinate 1 for Training Data", ylab="Coordinate 2 for Training Data", col=plot_colors[ci], type="p" ) lines( MSProj[ci,1], MSProj[ci,2], col=plot_colors[ci], type="p", cex=10, pch="." ) } } #dev.off()