search for: nfold

Displaying 18 results from an estimated 18 matches for "nfold".

Did you mean: fold
2011 Jan 06
1
Cross validation for Ordinary Kriging
ear ALL, The last part of my thesis analysis is the cross validation. Right now I am having difficulty using the cross validation of gstat. Below are my commands with the tsport_ace as the variable: nfold <- 3 part <- sample(1:nfold, 69, replace = TRUE) sel <- (part != 1) m.model <- x2[sel, ] m.valid <- x2[-sel, ] t<- fit.variogram(v,vgm(0.0437, "Exp", 26, 0)) cv69 <- krige.cv(tsport_ace ~ 1, x2, t, nfold = nrow(x2)) The last line gives an error saying: Error in Spati...
2011 Feb 17
1
cv.glmnet errors
Hi, I am trying to do multinomial regression using the glmnet package, but the following gives me an error (for no reason apparent to me): library(glmnet) cv.glmnet(x=matrix(c(1,2,3,4,5,6,1,2,3,4,5,6), nrow=6),y=as.factor(c(1,2,1,2,3,3)),family='multinomial',alpha=0.5, nfolds=2) The error i get is: Error in if (outlist$msg != "Unknown error") return(outlist) : argument is of length zero If i change the number of folds to 1, i get a seg fault: *** caught segfault *** address 0x0, cause 'memory not mapped' Traceback: 1: .Fortran("lognet&quo...
2012 Jun 15
0
argument "x" is missing, with no default - Please help find argument x
...all accuracy. cv.evaluate$correct <- cv.evaluate$prediction == cv.evaluate$remitter mymean<-mean(cv.evaluate$correct) retlist<-data.frame(mtry, sumvar$se, sumvar$sp, mean(cv.evaluate$correct)) return(retlist) } subloop<- function(mtry=mtry, ml.frame=ml.frame, ntrees=ntrees) { nfolds<- 10 # shuffle the numbers and divide into 10 groups numberOfRows<-dim(ml.frame)[1] lengthOfDiv<-numberOfRows/nfolds shuffled<-sample(c(1:numberOfRows), numberOfRows, replace=F) rownumber<-split(shuffled, 1:nfolds) #combine mymean into my vec myvec<-foreach (i = 1:l...
2011 Jun 20
2
Error of Cross Validation
Dear R users: Recently, I tried to write a program to calculate cross-validated predicted value. My sources are as follows. However, the R reported an error. Could you please check the sources? Thanks. set.seed(100) x<-rnorm(100) y<-sample(rep(0:1,50),replace=T) dat<-data.frame(x,y) library(rms) fito<-lrm(y~x) preo<-predict(fito) pre<-matrix(NA,nrow=100,ncol=200) for (i in
2012 May 28
0
GLMNET AUC vs. MSE
...ent story). Thanks in advance for any advice. Below is my code and sample output for AUC/MSE. xc <- split(dataS$P1_retained, dataS$TotalHours_R) yc <- split(dataS$x, dataS$TotalHours_R) for (i in 1:length(yc)) { fit=cv.glmnet(as.matrix(yc[[i]]), y=xc[[i]], alpha=.05, type="mse", nfolds=10, standardize=TRUE,family="binomial") c_output = c(i,fit$cvlo[fit$lambda==fit$lambda.1se],fit$cvm[fit$lambda==fit$lambda.1se], fit$cvup[fit$lambda==fit$lambda.1se]) names(c_output) = names(output_x) output_x = rbind(output_x, t(c_output)) fit1=cv.glmnet(as.matrix(yc[[i]]), y=xc[[i]],...
2011 Aug 11
1
Cv.glment question -- why giving me an error
Hi All,  I am trying to run cv.glmnet(x,y,family="multinomial", nfolds =4) and I only have 8 observations and the number of features I have is 1000, so my x matrix is 8 by 1000 and when I run the following, I get this error, I am not sure what is causing this problem.  Error in predmat[which, , seq(nlami)] = preds :   number of items to replace is not a multiple of r...
2011 Oct 12
1
CVbinary - Help
...ry response) but I got an error with CVbinary. Well I did this: fit <- lm(resp ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + PC8 + PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC18+PC19+PC20+PC21+PC22+PC23+PC24+PC25+PC26+PC27+PC28, data = dexp.cp, family=binomial()) CVbinary(fit) Error in sample(nfolds, m, replace = TRUE) : invalid 'size' argument I cannot understand this error, I was googling it, but i didn't find nothing really helpfull. Can someone help with is?...It's really important. Thank you for your time, Ana Rita -- View this message in context: http://r.789695.n4.n...
2007 Jan 22
0
Recursive-SVM (R-SVM)
...and data is within the code). I am running into some errors. I am not an expert on svm's. If any one has used it, I would appreciate their help. I am appending the code below. Thanks../Murli ####################################################### ### R-code for R-SVM ### use leave-one-out / Nfold or bootstrape to permute data for external CV ### build SVM model and use mean-balanced weight to sort genes on training set ### and recursive elimination of least important genes ### author: Dr. Xin Lu, Research Scientist ### Biostatistics Department, Harvard School of Public Health library(e...
2011 Jul 21
1
Error: bad index in plotmo functions for MARS model (package earth)
...####### > > ### example code: > library( earth ) > data( gasoline, package='pls' ) > > nir <- gasoline$NIR > dim( nir ) [1] 60 401 > class( nir ) [1] "AsIs" > > oct <- gasoline$octane > > mars <- earth( oct ~ nir, nk=300, nfold=10, degree=3, trace=0 ) > > plotmo( mars ) Error: bad index (missing column in x?) > plotmo( mars, all1=T ) Error: bad index (missing column in x?) > plotmo( mars, all1=T, all2=T ) Error: bad index (missing column in x?) > > sessionInfo() R version 2.13.1 (2011-07-08) Platf...
2007 Aug 11
1
LDA and RDA: different training errors
...response % variable. This matrix is then transposed tmp = rda(x, y, alpha=0, delta=0) rda.training.err = tmp$error / dim(x)[2] % The training error provided by rda.cv() is also different % from the training errors provided by lda() or rda() tmp.cv = rda.cv(tmp, x=x, y=y, nfold=10) tmp.cv$err / dim(x)[2] / 10 Thanks a lot!
2011 Jan 16
1
Memory issues
...t of LASSO regression on several subsets of a big dataset. For some subsets it works well, and for some bigger subsets it does not work, with errors of type "cannot allocate vector of size 1.6Gb". The error occurs at this line of the code: example <- cv.glmnet(x=bigmatrix, y=price, nfolds=3) It also depends on the number of variables that were included in "bigmatrix". I tried on R and R64 for both Mac and R for PC but recently went onto a faster virtual machine on Linux thinking I would avoid any memory issues. It was better but still had some limits, even though memo...
2013 Jul 17
1
glmnet on Autopilot
...cv.glmnet(x, ly, family = "binomial", alpha = 1, # lasso penalty type.measure = "deviance", standardize = FALSE, intercept = FALSE, nfolds = 10, keep = FALSE) plot(fit.net) log(fit.net$lambda.1se) pred <- predict(fit.net, x, type = "response", s = "lambda.1se") all(coef(fit.net) == 0) all(pred ==0.5) Thanks in advance for your thoughts. Regards, Lars. [[alternative HTML...
2011 May 01
1
Different results of coefficients by packages penalized and glmnet
...rdize=TRUE) coef(pena.fit2) #lasso using gamnet library(glmnet) factors<-matrix(c(CN,NoSus),ncol=2) colnames(factors)<-c("CN","NoSus") glmn.fit2<-glmnet(x=factors,y=HRLNM,family="binomial") cvglmnet<-cv.glmnet(x=factors,y=HRLNM,family="binomial",nfolds=5) plot(cvglmnet) cvglmnet$lambda.min which(cvglmnet$lambda==cvglmnet$lambda.min) glmn.fit2<-glmnet(x=factors,y=HRLNM,family="binomial",lambda=cvglmnet$lambda.min) coef(glmn.fit2) Thanks a lot btw: how to calculate the C.I. of coefs? *Yao Zhu* *Department of Urology Fudan Univer...
2011 May 24
1
seeking help on using LARS package
...t; for a Bioinformatics project that we are working on. I know that the authors of the paper are using Lasso regression and so far looking at their paper this is what I have gotten to. xtrain <- trainData > dim(trainData) [1] 18520 88 ytrain <- trainScore length(ytrain) [1] 18520 nfolds <- 100 epsilon <- exp(-10) # code from JP Vert object1 <- cv.lars(xtrain,ytrain, K=nfolds, fraction = seq(from = 0, to = 1 , length= 1000), type='lasso', eps=epsilon, plot.it=TRUE) bestfraction <- object1$fraction[min(which(object1$cv <= min(object1$cv)+ 0.01*(max(object...
2006 Apr 27
0
pamr package: pamr.adaptthresh() error rates
...t;- list(x= mat,y=factor(actclass),geneid = geneid ,genenames=gs) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 10, reduction.factor = 0.9) mytrain2 <- pamr.train(mydata,threshold.scale = new.scales) mycv <- pamr.cv(mytrain2,mydata,nfold = 10) res1 <- pamr.confusion(mycv, threshold = mytrain2$threshold.scale,extra = FALSE) print(res1) res2 <- pamr.confusion(mycv, threshold = 2,extra = FALSE) print(res2) ########################### END CODE ############################### ------------...
2006 Apr 27
0
package pamr: pamr.adaptthresh() error rates
...t)) mydata <- list(x= mat,y=factor(actclass),geneid = geneid ,genenames=gs) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 10, reduction.factor = 0.9) mytrain2 <- pamr.train(mydata,threshold.scale = new.scales) mycv <- pamr.cv(mytrain2,mydata,nfold = 10) res1 <- pamr.confusion(mycv, threshold = mytrain2$threshold.scale,extra = FALSE) print(res1) res2 <- pamr.confusion(mycv, threshold = 2,extra = FALSE) print(res2) ########################### END CODE ############################### ---...
2006 Apr 27
0
package pamr: pamr.adapthresh() ---- Take 2!
...t;- list(x= mat,y=factor(actclass),geneid = geneid ,genenames=gs) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 10, reduction.factor = 0.9) mytrain2 <- pamr.train(mydata,threshold.scale = new.scales) mycv <- pamr.cv(mytrain2,mydata,nfold = 10) res1 <- pamr.confusion(mycv, threshold = mytrain2$threshold.scale,extra = FALSE) print(res1) res2 <- pamr.confusion(mycv, threshold = 2,extra = FALSE) print(res2) ########################### END CODE ############################### ----------------...
2010 Jan 21
5
Logistic regression
can you do Logistic regression in R, if so how do you do it and how do you test the fit of a model? -- View this message in context: http://n4.nabble.com/Logistic-regression-tp1059870p1059870.html Sent from the R help mailing list archive at Nabble.com.