[Analogue-commits] r412 - in pkg: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 15 00:07:09 CET 2014


Author: gsimpson
Date: 2014-02-15 00:07:08 +0100 (Sat, 15 Feb 2014)
New Revision: 412

Modified:
   pkg/R/crossval.pcr.R
   pkg/inst/ChangeLog
Log:
the progressbar was resetting between repeats of k-fold CV

Modified: pkg/R/crossval.pcr.R
===================================================================
--- pkg/R/crossval.pcr.R	2014-02-14 23:00:39 UTC (rev 411)
+++ pkg/R/crossval.pcr.R	2014-02-14 23:07:08 UTC (rev 412)
@@ -74,6 +74,7 @@
         pred <- array(NA, dim = c(N, ncomp, folds))
         if(verbose) {
             writeLines("\n   n k-fold Cross-validation:")
+            ii <- 1
             pb <- txtProgressBar(min = 0, max = folds * nfold, style = 3)
             on.exit(close(pb))
             on.exit(cat("\n"), add = TRUE)
@@ -86,8 +87,10 @@
             pind <- ind[sample.int(N, N, replace = FALSE)]
             ## the main k-fold CV loop
             for(k in seq_len(nfold)) {
-                if(verbose)
-                    setTxtProgressBar(pb, i * k)
+                if(verbose) {
+                    setTxtProgressBar(pb, ii)
+                    ii <- ii + 1
+                }
                 sel <- pind == k   ## sel is samples in leave out group
                 N.oob <- sum(sel) ## N in leave out group
                 N.mod <- sum(!sel)  ## N in the model

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2014-02-14 23:00:39 UTC (rev 411)
+++ pkg/inst/ChangeLog	2014-02-14 23:07:08 UTC (rev 412)
@@ -5,6 +5,9 @@
 	* crossval.pcr: Fixed a number of bugs in the method for PCR
 	related to k-fold cross validation, which were causing errors.
 
+	Fix the verbose printing of the progress bar, which would reset
+	between repeats in k-fold CV.
+
 	* predict.pcr: would set argument `ncomp` incorrectly (in the
 	wrong form) if not supplied.
 



More information about the Analogue-commits mailing list