# train classifier on Alon's Colon Cancer Data set after a logarithmic transformation
# (selecting genes by the Expanded HC scheme).
ldarule <- Slda(log10(AlonDS[,-1]),AlonDS$grouping)
# show classification rule
print(ldarule)
# get in-sample classification results
predict(ldarule,log10(AlonDS[,-1]),grpcodes=levels(AlonDS$grouping))$class
# compare classifications with true assignments
cat("Original classes:
")
print(AlonDS[,1])
# Estimate error rates by four-fold cross-validation.
# (Note: In cross-validation analysis it is recommended to set the argument
# 'ldafun' to "classification", in order to speed up computations by avoiding
# unecessary eigen-decompositions)
CrosValRes <- DACrossVal(log10(AlonDS[,-1]),AlonDS$grouping,TrainAlg=Slda,ldafun="classification",
kfold=4,CVrep=1)
summary(CrosValRes[,,"Clerr"])Run the code above in your browser using DataLab