[Mboost-commits] r761 - in pkg: mboostDevel mboostDevel/R mboostDevel/man mboostPatch
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 13 12:00:35 CET 2014
Author: hofner
Date: 2014-02-13 12:00:34 +0100 (Thu, 13 Feb 2014)
New Revision: 761
Modified:
pkg/mboostDevel/DESCRIPTION
pkg/mboostDevel/NAMESPACE
pkg/mboostDevel/R/methods.R
pkg/mboostDevel/man/methods.Rd
pkg/mboostPatch/DESCRIPTION
pkg/mboostPatch/NAMESPACE
Log:
- added argument "which" to variable.names()
to extract only a subset of names
Modified: pkg/mboostDevel/DESCRIPTION
===================================================================
--- pkg/mboostDevel/DESCRIPTION 2014-02-04 15:09:34 UTC (rev 760)
+++ pkg/mboostDevel/DESCRIPTION 2014-02-13 11:00:34 UTC (rev 761)
@@ -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, quadprog
+Imports: Matrix, survival, splines, lattice, nnls, quadprog, utils
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 2014-02-04 15:09:34 UTC (rev 760)
+++ pkg/mboostDevel/NAMESPACE 2014-02-13 11:00:34 UTC (rev 761)
@@ -8,6 +8,7 @@
importFrom(lattice, levelplot)
importFrom(nnls, nnls)
importFrom(quadprog, solve.QP)
+importFrom(utils, packageDescription)
export(glmboost,
gamboost,
Modified: pkg/mboostDevel/R/methods.R
===================================================================
--- pkg/mboostDevel/R/methods.R 2014-02-04 15:09:34 UTC (rev 760)
+++ pkg/mboostDevel/R/methods.R 2014-02-13 11:00:34 UTC (rev 761)
@@ -395,8 +395,10 @@
invisible(x)
}
-variable.names.mboost <- function(object, ...) {
+variable.names.mboost <- function(object, which = NULL, usedonly = FALSE, ...) {
+ which <- object$which(which, usedonly = usedonly)
+
args <- list(...)
if (length(args) > 0)
warning("Arguments ", paste(names(args), sep = ", "), " unknown")
@@ -406,18 +408,32 @@
paste(x$get_names(), collapse = ", "))
### </FIXME>
if (is.matrix(ret)) ret <- ret[, , drop = TRUE]
- ret
+ ret[which]
}
-variable.names.glmboost <- function(object, ...) {
+variable.names.glmboost <- function(object, which = NULL, usedonly = FALSE, ...) {
+ if (usedonly) {
+ which <- object$which(usedonly = TRUE)
+ ## if center = TRUE for model fitting intercept is implicitly selected
+ center <- get("center", envir = environment(object$newX))
+ if (center){
+ intercept <- which(object$assign == 0)
+ INTERCEPT <- sum(object$assign == 0) == 1
+ if (INTERCEPT && !intercept %in% which)
+ which <- c(intercept, which)
+ }
+ } else {
+ which <- object$which(which)
+ }
+
args <- list(...)
if (length(args) > 0)
warning("Arguments ", paste(names(args), sep = ", "), " unknown")
ret <- object$baselearner[[1]]$get_names()
names(ret) <- ret
- ret
+ ret[which]
}
@@ -478,7 +494,7 @@
switch(what,
"coefficients" = return(coef(object, which = which)),
"residuals" = return(residuals(object)),
- "variable.names" = return(variable.names(object)),
+ "variable.names" = return(variable.names(object, which)),
"bnames" = return(get("bnames", envir = environment(object$update))[which]),
"offset" = return(object$offset),
"nuisance" = return(nuisance(object)),
@@ -515,7 +531,7 @@
switch(what,
"coefficients" = return(coef(object, which = which)),
"residuals" = return(residuals(object)),
- "variable.names" = return(variable.names(object)),
+ "variable.names" = return(variable.names(object, which)),
"bnames" = return(get("bnames", envir = environment(object$update))[which]),
"offset" = return(object$offset),
"nuisance" = return(nuisance(object)),
Modified: pkg/mboostDevel/man/methods.Rd
===================================================================
--- pkg/mboostDevel/man/methods.Rd 2014-02-04 15:09:34 UTC (rev 760)
+++ pkg/mboostDevel/man/methods.Rd 2014-02-13 11:00:34 UTC (rev 761)
@@ -86,8 +86,8 @@
\method{residuals}{mboost}(object, ...)
\method{resid}{mboost}(object, ...)
-\method{variable.names}{glmboost}(object, ...)
-\method{variable.names}{mboost}(object, ...)
+\method{variable.names}{glmboost}(object, which = NULL, usedonly = FALSE, ...)
+\method{variable.names}{mboost}(object, which = NULL, usedonly = FALSE, ...)
\method{extract}{mboost}(object, what = c("design", "penalty", "lambda", "df",
"coefficients", "residuals",
@@ -122,6 +122,8 @@
predictions or coefficients. If \code{which} is given
(as an integer vector or characters corresponding
to base-learners) a list or matrix is returned.}
+ \item{usedonly}{ logical. Indicating whether all variable names should
+ be returned or only those selected in the boosting algorithm.}
\item{type}{ the type of prediction required. The default is on the scale
of the predictors; the alternative \code{"response"} is on
the scale of the response variable. Thus for a
@@ -140,7 +142,7 @@
of the base-learner of the \eqn{j}th boosting
iteration (and zero if the base-learner is not
selected in this iteration).}
- \item{off2int}{ logical indicating whether the offset should be
+ \item{off2int}{ logical. Indicating whether the offset should be
added to the intercept (if there is any)
or if the offset is returned as attribute of
the coefficient (default).}
Modified: pkg/mboostPatch/DESCRIPTION
===================================================================
--- pkg/mboostPatch/DESCRIPTION 2014-02-04 15:09:34 UTC (rev 760)
+++ pkg/mboostPatch/DESCRIPTION 2014-02-13 11:00:34 UTC (rev 761)
@@ -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, survival
-Imports: Matrix, splines, lattice
+Imports: Matrix, splines, lattice, utils
Suggests: party (>= 1.0-3), TH.data, MASS, fields,
BayesX, gbm, mlbench, RColorBrewer, rpart (>= 4.0-3)
LazyData: yes
Modified: pkg/mboostPatch/NAMESPACE
===================================================================
--- pkg/mboostPatch/NAMESPACE 2014-02-04 15:09:34 UTC (rev 760)
+++ pkg/mboostPatch/NAMESPACE 2014-02-13 11:00:34 UTC (rev 761)
@@ -6,6 +6,7 @@
importFrom(survival, Surv, survfit)
importFrom(splines, bs, splineDesign)
importFrom(lattice, levelplot)
+importFrom(utils, packageDescription)
export(glmboost,
gamboost,
More information about the Mboost-commits
mailing list