[Mboost-commits] r844 - in pkg/mboostDevel: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 9 14:28:10 CEST 2015


Author: hofner
Date: 2015-04-09 14:28:10 +0200 (Thu, 09 Apr 2015)
New Revision: 844

Modified:
   pkg/mboostDevel/R/AAA.R
   pkg/mboostDevel/R/bl.R
   pkg/mboostDevel/inst/NEWS.Rd
   pkg/mboostDevel/man/baselearners.Rd
Log:
Speed up of df2lambda
- new option options(mboost_check_df2lambda = TRUE), which controlls whether
  a stability check in df2lambda is performed (which is slow for large matrices)
- stopped computing the singular vectors, which is slow for large matrices

Modified: pkg/mboostDevel/R/AAA.R
===================================================================
--- pkg/mboostDevel/R/AAA.R	2015-04-02 09:41:44 UTC (rev 843)
+++ pkg/mboostDevel/R/AAA.R	2015-04-09 12:28:10 UTC (rev 844)
@@ -1,28 +1,3 @@
-
-#.onAttach <- function(libname, pkgname) {
-#
-#    sup <- file.path(libname, pkgname, "startup.txt")
-#    if (file.exists(sup) || !interactive()) return(TRUE)
-#    if (!suppressWarnings(file.create(sup))) return(TRUE)
-#    file.remove(sup)
-#    version <- packageDescription(pkg = pkgname)$Version
-#    txt <- c("\n",
-#             paste("	Welcome to ", sQuote("mboost"),
-#                   " version ", version, "!", sep = ""),
-#             "\n",
-#             "The user-interface changed in some places.",
-#             paste("Most important, subsetting an", sQuote("mboost"),
-#                   "object modifies this object now."),
-#             "Please read the NEWS file, consult the documentation and have fun!",
-#             "\n",
-#             "Would you like to see this message on startup again?")
-#    packageStartupMessage(txt)
-#    choice <- menu(c("Please, no!", "Yes, please!"))
-#    if (choice == 2) return(TRUE)
-#    file.create(sup)
-#    return(TRUE)
-#}
-
 .onAttach <- function(libname, pkgname) {
 
     ## get package version
@@ -44,7 +19,9 @@
             mboost_dftraceS = FALSE,  ### df = trace(S) or df = trace(2 S - StS)
             mboost_lambdaMax = 1e+15,### maximum value for lambda as used in df2lambda
             mboost_Xmonotone = FALSE,### don't force monotonicity in %X%
-            mboost_eps = 10e-10)     ### factor for dmat in df2lambda
+            mboost_eps = 10e-10, ### factor for dmat in df2lambda
+            mboost_check_df2lambda = TRUE) ### check if max(abs(X)) > 10 in df2lambda
+                                 ### as this might take a while experts can skip this check
 }
 
 .onUnload <- function(libpath) {

Modified: pkg/mboostDevel/R/bl.R
===================================================================
--- pkg/mboostDevel/R/bl.R	2015-04-02 09:41:44 UTC (rev 843)
+++ pkg/mboostDevel/R/bl.R	2015-04-09 12:28:10 UTC (rev 844)
@@ -12,7 +12,7 @@
         if (lambda == 0) return(c(df = ncol(X), lambda = 0))
 
     ## check for possible instability
-    if (max(abs(X)) > 10)
+    if (options("mboost_check_df2lambda")[[1]] && max(abs(X)) > 10)
         warning("Some absolute values in design matrix are greater 10. Hence, ",
                 sQuote("df2lambda"), " might be numerically instable.\n  ",
                 "See documentation of argument ", sQuote("by"),
@@ -33,8 +33,11 @@
     }
     A <- XtX + dmat * options("mboost_eps")[[1]]
     Rm <- solve(chol(A))
-    decomp <- svd(crossprod(Rm, dmat) %*% Rm)
-    d <- decomp$d
+    ## singular value decomposition without singular vectors
+    d <- try(svd(crossprod(Rm, dmat) %*% Rm, nu=0, nv=0)$d)
+    ## if unsucessfull try the same computation but compute singular vectors as well
+    if (inherits(d, "try-error"))
+        d <- svd(crossprod(Rm, dmat) %*% Rm)$d
 
     ### option
     if (options("mboost_dftraceS")[[1]]){

Modified: pkg/mboostDevel/inst/NEWS.Rd
===================================================================
--- pkg/mboostDevel/inst/NEWS.Rd	2015-04-02 09:41:44 UTC (rev 843)
+++ pkg/mboostDevel/inst/NEWS.Rd	2015-04-09 12:28:10 UTC (rev 844)
@@ -8,17 +8,26 @@
       the model on each subsample until \code{q} variables were selected
       (or \code{mstop} is reached)
       \item Better handling of errors in (single) folds of \code{cvrisk}:
-      results of folds without errors are used and a \code{warning} is issued.
+      results of folds without errors are used and a \code{warning} is
+      issued.
     }
   }
   \subsection{Miscellaneous}{
     \itemize{
-      \item
+      \item Added new option \code{options(mboost_check_df2lambda =
+	TRUE)}, which controlls if a stability check in \code{df2lambda}
+      is performed. If set to \code{FALSE} this might speed up the
+      computation of \code{df2lambda} especially with large design
+      matrices.
+      \item Stopped computing the singular vectors in \code{df2lambda}
+      as the singular values are sufficient and as
+      \dQuote{computing the singular vectors is the slow part for large
+	matrices} (proposed by Fabian Scheipl).
     }
   }
   \subsection{Bug-fixes}{
     \itemize{
-      \item
+      \item \code{PropOdds()}: fixed bug if \code{offset} was specified.
     }
   }
 }

Modified: pkg/mboostDevel/man/baselearners.Rd
===================================================================
--- pkg/mboostDevel/man/baselearners.Rd	2015-04-02 09:41:44 UTC (rev 843)
+++ pkg/mboostDevel/man/baselearners.Rd	2015-04-09 12:28:10 UTC (rev 844)
@@ -1,4 +1,6 @@
 \name{baselearners}
+\alias{baselearner}
+\alias{base-learner}
 \alias{bols}
 \alias{bbs}
 \alias{bspatial}



More information about the Mboost-commits mailing list