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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 27 13:19:21 CEST 2015


Author: hofner
Date: 2015-04-27 13:19:21 +0200 (Mon, 27 Apr 2015)
New Revision: 853

Modified:
   pkg/mboostDevel/R/bkronecker.R
   pkg/mboostDevel/R/crossvalidation.R
   pkg/mboostDevel/inst/NEWS.Rd
   pkg/mboostDevel/man/cvrisk.Rd
Log:
fixed df2lambda for bkronecker

Modified: pkg/mboostDevel/R/bkronecker.R
===================================================================
--- pkg/mboostDevel/R/bkronecker.R	2015-04-26 19:00:18 UTC (rev 852)
+++ pkg/mboostDevel/R/bkronecker.R	2015-04-27 11:19:21 UTC (rev 853)
@@ -41,7 +41,7 @@
 
     dpp <- function(weights) {
 
-        if (!is.null(attr(X$X1, "deriv")) || !is.null(attr(X$X2, "deriv")))
+        if (!is.null(attr(X$X1, "deriv")) || !is.null(attr(X$X2, "deriv"))) 
             stop("fitting of derivatives of B-splines not implemented")
 
         W <- matrix(weights, nrow = n1, ncol = n2)
@@ -53,7 +53,7 @@
         XtX <- array(XtX, c(c1, c1, c2, c2))
         XtX <- mymatrix(aperm(XtX, c(1, 3, 2, 4)), nrow = c1 * c2)
 
-        ### If lambda was given in both baselearners, we
+        ### If lambda was given in both baselearners, we 
         ### directly multiply the marginal penalty matrices by lambda
         ### and then compute the total penalty as the kronecker sum.
         ### args$lambda is NA in this case and we don't compute
@@ -61,8 +61,7 @@
         if (is.null(args$lambda)) {
 
             ### <FIXME>: is there a better way to feed XtX into lambdadf?
-            ### <FIXME>: is ncol(X$X1) + ncol(X$X2) ok or should it be rankMatrix(...)?
-            lambdadf <- df2lambda(X = diag(ncol(X$X1) + ncol(X$X2)),
+            lambdadf <- df2lambda(X = diag(rankMatrix(X$X1, method = 'qr') * rankMatrix(X$X2, method = 'qr')),
                                   df = args$df, lambda = args$lambda,
                                   dmat = K, weights = weights, XtX = XtX)
             ### </FIXME>
@@ -75,10 +74,10 @@
         XtX <- XtX + K
 
         ### nnls
-        constr <- (!is.null(attr(X$X1, "constraint"))) +
+        constr <- (!is.null(attr(X$X1, "constraint"))) + 
                   (!is.null(attr(X$X2, "constraint")))
 
-        if (constr == 2)
+        if (constr == 2) 
             stop("only one dimension may be subject to constraints")
         constr <- constr > 0
 
@@ -235,7 +234,7 @@
     l1 <- args1$lambda
     l2 <- args2$lambda
     if (xor(is.null(l1), is.null(l2)))
-        stop("lambda needs to be given in both baselearners combined with ",
+        stop("lambda needs to be given in both baselearners combined with ", 
              sQuote("%O%"))
     if (!is.null(l1) && !is.null(l2)) {
         ### there is no common lambda!

Modified: pkg/mboostDevel/R/crossvalidation.R
===================================================================
--- pkg/mboostDevel/R/crossvalidation.R	2015-04-26 19:00:18 UTC (rev 852)
+++ pkg/mboostDevel/R/crossvalidation.R	2015-04-27 11:19:21 UTC (rev 853)
@@ -84,7 +84,7 @@
                                                    oobweights = OOBweights[, i])),
                           ...)
     }
-    ## if any errors if mclapply was used: remove result and issue a warning
+    ## if any errors occured remove results and issue a warning
     if (any(idx <- sapply(oobrisk, is.character))) {
         warning(sum(idx), " fold(s) encountered an error. ",
                 "Results are based on ", ncol(folds) - sum(idx),

Modified: pkg/mboostDevel/inst/NEWS.Rd
===================================================================
--- pkg/mboostDevel/inst/NEWS.Rd	2015-04-26 19:00:18 UTC (rev 852)
+++ pkg/mboostDevel/inst/NEWS.Rd	2015-04-27 11:19:21 UTC (rev 853)
@@ -15,6 +15,8 @@
       \item Predictions for \code{bbs} and \code{bmono} now use linear
       extrapolation (user request inspired by
       \code{mgcv::Predict.matrix.pspline.smooth}).
+      \item Parallel computing via \code{mclapply}: Set
+      \code{mc.preschedule = FALSE} per default.
     }
   }
   \subsection{Miscellaneous}{

Modified: pkg/mboostDevel/man/cvrisk.Rd
===================================================================
--- pkg/mboostDevel/man/cvrisk.Rd	2015-04-26 19:00:18 UTC (rev 852)
+++ pkg/mboostDevel/man/cvrisk.Rd	2015-04-27 11:19:21 UTC (rev 853)
@@ -40,7 +40,6 @@
   \item{mc.preschedule}{
     preschedule tasks if are parallelized using \code{\link{mclapply}}
     (default: \code{FALSE})? For details see \code{\link{mclapply}}.
-
   }
   \item{weights}{ a numeric vector of weights for the model to be cross-validated.}
   \item{type}{ character argument for specifying the cross-validation



More information about the Mboost-commits mailing list