[Mboost-commits] r751 - / pkg/mboostDevel pkg/mboostDevel/R pkg/mboostDevel/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 17 14:21:13 CEST 2013


Author: hofner
Date: 2013-10-17 14:21:13 +0200 (Thu, 17 Oct 2013)
New Revision: 751

Removed:
   README
Modified:
   pkg/mboostDevel/DESCRIPTION
   pkg/mboostDevel/NAMESPACE
   pkg/mboostDevel/R/bmono.R
   pkg/mboostDevel/R/helpers.R
   pkg/mboostDevel/man/baselearners.Rd
Log:
- replaced lsei ("limSolve") with solve.QP ("quadprog") 
  to increase speed and stability of estimates


Deleted: README
===================================================================
--- README	2013-10-17 09:42:19 UTC (rev 750)
+++ README	2013-10-17 12:21:13 UTC (rev 751)
@@ -1,49 +0,0 @@
-			R-Forge SVN README
-
-
-(See "http://download.r-forge.r-project.org/manuals/R-Forge_Manual.pdf"
-       for detailed information on registering a new project.
-
-1. Introduction
------------------------------------------------------------------------
-R is free software distributed under a GNU-style copyleft. R-Forge is
-a service for R users and package developers providing certain tools
-for collaborative source code management.
-
-2. The directory you're in
------------------------------------------------------------------------
-This is the repository of your project. It contains two important
-pre-defined directories namely 'www' and 'pkg'. They must not be
-deleted otherwise R-Forge's core functionality will not be available
-(daily check and build of your package or project websites).
-These two directories are standardized and therefore are going to be
-described in this README. The rest of your repository can be used as
-you like.
-
-3. 'pkg' directory
------------------------------------------------------------------------
-Typically this directory contains the R package with the usual
-DESCRIPTION and R/, man/, data/ directories etc (see 'Writing R 
-Extension' for more details). In the future it will also be possible to
-have multiple packages managed by a control file, however currently
-this feature is still under development).
-
-Furthermore, this directory will be checked out daily, the package is
-checked and if it passes this procedure it is build and made available at
-http://R-Forge.R-project.org/src/contrib/ (as source tar.gz and win32
-.zip). It should be possible to install the package via
-install.packages("foo",url="R-Forge.R-project.org") within R
-then.
-
-4. 'www' directory
------------------------------------------------------------------------
-This directory contains your project homepage which is available at
-http://<projectname>.R-Forge.R-project.org. 
-Note that it will be checked out daily, so please take
-into consideration that it will not be available right after you
-commit your changes or updates. 
-
-5. Help
------------------------------------------------------------------------
-If you need help don't hesitate to contact us
-(R-Forge at R-project.org)

Modified: pkg/mboostDevel/DESCRIPTION
===================================================================
--- pkg/mboostDevel/DESCRIPTION	2013-10-17 09:42:19 UTC (rev 750)
+++ pkg/mboostDevel/DESCRIPTION	2013-10-17 12:21:13 UTC (rev 751)
@@ -16,7 +16,7 @@
   trees as base-learners for fitting generalized linear, additive
   and interaction models to potentially high-dimensional data.
 Depends: R (>= 2.14.0), methods, stats, parallel
-Imports: Matrix, survival, splines, lattice, nnls, limSolve
+Imports: Matrix, survival, splines, lattice, nnls, quadprog
 Suggests: party (>= 1.0-3), TH.data, MASS, fields, BayesX, gbm, mlbench,
         RColorBrewer, rpart (>= 4.0-3)
 LazyData: yes

Modified: pkg/mboostDevel/NAMESPACE
===================================================================
--- pkg/mboostDevel/NAMESPACE	2013-10-17 09:42:19 UTC (rev 750)
+++ pkg/mboostDevel/NAMESPACE	2013-10-17 12:21:13 UTC (rev 751)
@@ -7,7 +7,7 @@
 importFrom(splines, bs, splineDesign)
 importFrom(lattice, levelplot)
 importFrom(nnls, nnls)
-importFrom(limSolve, lsei)
+importFrom(quadprog, solve.QP)
 
 export(glmboost,
        gamboost,

Modified: pkg/mboostDevel/R/bmono.R
===================================================================
--- pkg/mboostDevel/R/bmono.R	2013-10-17 09:42:19 UTC (rev 750)
+++ pkg/mboostDevel/R/bmono.R	2013-10-17 12:21:13 UTC (rev 751)
@@ -2,7 +2,7 @@
 bmono <- function(..., constraint = c("increasing", "decreasing",
                                       "convex", "concave", "none",
                                       "positive", "negative"),
-                  type = c("iterative", "lsei"),
+                  type = c("iterative", "quad.prog"),
                   by = NULL, index = NULL, knots = 20, boundary.knots = NULL,
                   degree = 3, differences = 2, df = 4,
                   lambda = NULL, lambda2 = 1e6, niter = 10,
@@ -295,7 +295,7 @@
                                 "You could try increasing ", sQuote("niter"),
                                 " or ", sQuote("lambda2"))
                 }
-            } else {  ## i.e. type == "lsei"
+            } else {  ## i.e. type == "quad.prog"
                 if (lambda2[[2]] == 0) {
                     coef <- solveLSEI(XtX, crossprod(X, y),
                                       constraint = args$constraint)

Modified: pkg/mboostDevel/R/helpers.R
===================================================================
--- pkg/mboostDevel/R/helpers.R	2013-10-17 09:42:19 UTC (rev 750)
+++ pkg/mboostDevel/R/helpers.R	2013-10-17 12:21:13 UTC (rev 751)
@@ -237,10 +237,14 @@
         D <- rbind(D[[1]], D[[2]])
     ## NOTE: Currently both constraints get the same weight
 
-    cf <- lsei(A= XtX, B = Xty, G = D, H = rep(0, nrow(D)), type = 1,
-               E = matrix(0, nrow(XtX), nrow(XtX)), F = rep(0, nrow(XtX)),
-               tol = .Machine$double.eps,
-               tolrank = c(.Machine$double.eps, .Machine$double.eps),
-               fulloutput = TRUE)$X
+## first we used package limSolve
+#    cf <- lsei(A= XtX, B = Xty, G = D, H = rep(0, nrow(D)), type = 1,
+#               E = matrix(0, nrow(XtX), nrow(XtX)), F = rep(0, nrow(XtX)),
+#               tol = .Machine$double.eps,
+#               tolrank = c(.Machine$double.eps, .Machine$double.eps),
+#               fulloutput = TRUE)$X
+## but to reduce computational overhead we directly use quadprog
+    cf <- solve.QP(Dmat = XtX, dvec = as.vector(Xty), Amat = t(D),
+                   bvec = rep(0, nrow(D)))$solution
     cf
 }

Modified: pkg/mboostDevel/man/baselearners.Rd
===================================================================
--- pkg/mboostDevel/man/baselearners.Rd	2013-10-17 09:42:19 UTC (rev 750)
+++ pkg/mboostDevel/man/baselearners.Rd	2013-10-17 12:21:13 UTC (rev 751)
@@ -50,6 +50,7 @@
 bmono(...,
       constraint = c("increasing", "decreasing", "convex", "concave",
                      "none", "positive", "negative"),
+      type = c("iterative", "quad.prog"),
       by = NULL, index = NULL, knots = 20, boundary.knots = NULL,
       degree = 3, differences = 2, df = 4, lambda = NULL,
       lambda2 = 1e6, niter=10, intercept = TRUE,
@@ -170,6 +171,15 @@
     or "concave". Additionally, "none" can be used to specify
     unconstrained P-splines. This is especially of interest in
     conjunction with \code{boundary.constraints = TRUE}.}
+  \item{type}{
+    determines how the constrained least squares problem should be
+    solved. If \code{type = "iterative"}, the iterative procedure
+    described in  Hofner et al. (2011b) is used. If \code{type =
+      "quad.prog"}, a numeric quadratic programming method (Goldfarb and
+    Idnani, 1982, 1983) is used (see \code{\link{solve.QP}} in package
+    \pkg{quadprog}). The quadratic programming approach is usually much
+    faster than the iterative approach.
+  }
   \item{lambda2}{ penalty parameter for the (monotonicity) constraint. }
   \item{niter}{ maximum number of iterations used to compute constraint
     estimates. Increase this number if a warning is displayed. }
@@ -458,13 +468,21 @@
   Jan Gertheiss and Gerhard Tutz (2009), Penalized regression with ordinal
   predictors, \emph{International Statistical Review}, \bold{77}(3), 345--365.
 
+  D. Goldfarb and A. Idnani (1982),  Dual and Primal-Dual Methods
+  for Solving Strictly Convex Quadratic Programs.  In J. P. Hennart
+  (ed.), Numerical Analysis, Springer-Verlag, Berlin, pp. 226-239.
+
+  D. Goldfarb and A. Idnani (1983),  A numerically stable dual
+  method for solving strictly convex quadratic programs.
+  \emph{Mathematical Programming}, \bold{27}, 1--33.
+
   Benjamin Hofner, Torsten Hothorn, Thomas Kneib, and Matthias Schmid (2011a),
   A framework for unbiased model selection based on boosting.
   \emph{Journal of Computational and Graphical Statistics}, \bold{20}, 956--971.
 
   Benjamin Hofner, Joerg Mueller, and Torsten Hothorn (2011b),
   Monotonicity-Constrained Species Distribution Models,
-  \emph{Ecology}, 92:1895-1901.
+  \emph{Ecology}, \bold{92}, 1895--1901.
 
   Thomas Kneib, Torsten Hothorn and Gerhard Tutz (2009), Variable
   selection and model choice in geoadditive regression models,
@@ -479,8 +497,8 @@
     Machine Learning Research}, \bold{11}, 2109--2113.
 
   G. M. Beliakov (2000), Shape Preserving Approximation using Least Squares
-    Splines, \emph{Approximation Theory and its Applications}, bold{16}(4), 80-98.
-
+  Splines, \emph{Approximation Theory and its Applications},
+  \bold{16}(4), 80--98.
 }
 
 \seealso{\code{\link{mboost}}}



More information about the Mboost-commits mailing list