cross validation - R: PDA on 2 manners but with different results? -


i'm working on project have classify data breast cancer. want use pda. i'm trying found optimal value lambda 10-fold cross validation. i've started with:

breast[,1] <- as.numeric(breast[,1])   #because code works when classes numeric (so not factors were) 

i found done by:

library(penalizedlda) penalizedlda.cv(breast[,-1], breast[,1], lambdas = seq(0,0.5,by=.01), nfold = 10) 

but can manually:

lam <- seq(0,1,by=.01) length(lam) error.lam <- rep(0, length(lammie)) (la in 1:101){   error.pda <- rep(0,10)   (fold in 1:k){      currentfold <- folds[fold][[1]]    breast.pda = fda(diagnosis~., data=breast[-currentfold,], method=gen.ridge, lambda = lam[la])    pred.pda = predict(breast.pda, newdata= breast[currentfold,-1], type="class")    cv.table=table(breast[currentfold,1],pred.pda)    error.pda[fold] <- cv.table[1,2]+cv.table[2,1]    }   error.lam[la] <- sum(error.pda)/nrow } 

the strange thing become 2 different results. first i've got cv-error of 4.4% , value lambda 0.055. while second 1 become cv-error 6.32% , lamba 0.55. explain me differences between 2 methods?

silke


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -