diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2016-02-10 15:27:35 -0500 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2016-02-10 15:27:35 -0500 |
| commit | 904e559845f48f38c7eb928d65876e3a064a17c7 (patch) | |
| tree | 1d4153ad46cfe94bda2bd5dc3105acf67b2dc994 /man | |
| parent | redefine gamma to correspond to theory (diff) | |
| download | sparsestep-904e559845f48f38c7eb928d65876e3a064a17c7.tar.gz sparsestep-904e559845f48f38c7eb928d65876e3a064a17c7.zip | |
add documentation, unify implementations of path and fit
Diffstat (limited to 'man')
| -rw-r--r-- | man/print.sparsestep.Rd | 1 | ||||
| -rw-r--r-- | man/sparsestep.Rd | 45 | ||||
| -rw-r--r-- | man/sparsestep.path.Rd | 81 |
3 files changed, 111 insertions, 16 deletions
diff --git a/man/print.sparsestep.Rd b/man/print.sparsestep.Rd index 6680788..ec09981 100644 --- a/man/print.sparsestep.Rd +++ b/man/print.sparsestep.Rd @@ -1,6 +1,7 @@ % Generated by roxygen2 (4.1.1): do not edit by hand % Please edit documentation in R/print.sparsestep.R \name{print.sparsestep} +\alias{print} \alias{print.sparsestep} \title{Print the fitted SparseStep model} \usage{ diff --git a/man/sparsestep.Rd b/man/sparsestep.Rd index 3d4a311..b6e836e 100644 --- a/man/sparsestep.Rd +++ b/man/sparsestep.Rd @@ -6,10 +6,10 @@ \alias{sparsestep-package} \title{Fits the SparseStep model} \usage{ -sparsestep(x, y, lambda = 1, gamma0 = 1e+06, gammastop = 1e-08, - IMsteps = 2, gammastep = 2, normalize = TRUE, intercept = TRUE, - force.zero = TRUE, threshold = 1e-07, XX = NULL, Xy = NULL, - use.XX = TRUE, use.Xy = TRUE) +sparsestep(x, y, lambda = c(0.1, 0.5, 1, 5, 10), gamma0 = 1000, + gammastop = 1e-04, IMsteps = 2, gammastep = 2, normalize = TRUE, + intercept = TRUE, force.zero = TRUE, threshold = 1e-07, XX = NULL, + Xy = NULL, use.XX = TRUE, use.Xy = TRUE) } \arguments{ \item{x}{matrix of predictors} @@ -49,8 +49,26 @@ absolute zero} \item{use.Xy}{whether or not to compute X'y and return it} } \value{ -A "sparsestep" object is returned, for which predict, coef, methods -exist. +A "sparsestep" S3 object is returned, for which predict, coef, and +plot methods exist. It has the following items: +\item{call}{The call that was used to construct the model.} +\item{lambda}{The value(s) of lambda used to construct the model.} +\item{gamma0}{The gamma0 value of the model.} +\item{gammastop}{The gammastop value of the model} +\item{IMsteps}{The IMsteps value of the model} +\item{gammastep}{The gammastep value of the model} +\item{intercept}{Boolean indicating if an intercept was fitted in the +model} +\item{force.zero}{Boolean indicating if a force zero-setting was +performed.} +\item{threshold}{The threshold used for a forced zero-setting} +\item{beta}{The resulting coefficients stored in a sparse matrix format +(dgCMatrix). This matrix has dimensions nvar x nlambda} +\item{a0}{The intercept vector for each value of gamma of length nlambda} +\item{normx}{Vector used to normalize the columns of x} +\item{meanx}{Vector of column means of x} +\item{XX}{The matrix X'X if use.XX was set to TRUE} +\item{Xy}{The matrix X'y if use.Xy was set to TRUE} } \description{ Fits the SparseStep model for a single value of the @@ -59,10 +77,15 @@ regularization parameter. sparsestep. } \examples{ -data(diabetes) -attach(diabetes) -object <- sparsestep(x, y) -plot(object) -detach(diabetes) +x <- matrix(rnorm(100*20), 100, 20) +y <- rnorm(100) +fit <- sparsestep(x, y) +} +\author{ +Gertjan van den Burg (author and maintainer). +} +\seealso{ +\code{\link{coef}}, \code{\link{print}}, \code{\link{predict}}, +\code{\link{plot}}, and \code{\link{sparsestep.path}}. } diff --git a/man/sparsestep.path.Rd b/man/sparsestep.path.Rd index 43625d5..c038dd9 100644 --- a/man/sparsestep.path.Rd +++ b/man/sparsestep.path.Rd @@ -2,10 +2,12 @@ % Please edit documentation in R/path.sparsestep.R \name{sparsestep.path} \alias{sparsestep.path} -\title{Path algorithm for the SparseStep model} +\title{Approximate path algorithm for the SparseStep model} \usage{ -sparsestep.path(x, y, max.depth = 10, intercept = TRUE, normalize = TRUE, - ...) +sparsestep.path(x, y, max.depth = 10, gamma0 = 1000, gammastop = 1e-04, + IMsteps = 2, gammastep = 2, normalize = TRUE, intercept = TRUE, + force.zero = TRUE, threshold = 1e-07, XX = NULL, Xy = NULL, + use.XX = TRUE, use.Xy = TRUE) } \arguments{ \item{x}{matrix of predictors} @@ -14,10 +16,79 @@ sparsestep.path(x, y, max.depth = 10, intercept = TRUE, normalize = TRUE, \item{max.depth}{maximum recursion depth} -\item{...}{further arguments to sparsestep()} +\item{gamma0}{starting value of the gamma parameter} + +\item{gammastop}{stopping value of the gamma parameter} + +\item{IMsteps}{number of steps of the majorization algorithm to perform for +each value of gamma} + +\item{gammastep}{factor to decrease gamma with at each step} + +\item{normalize}{if TRUE, each variable is standardized to have unit L2 +norm, otherwise it is left alone.} + +\item{intercept}{if TRUE, an intercept is included in the model (and not +penalized), otherwise no intercept is included} + +\item{force.zero}{if TRUE, absolute coefficients smaller than the provided +threshold value are set to absolute zero as a post-processing step, +otherwise no thresholding is performed} + +\item{threshold}{threshold value to use for setting coefficients to +absolute zero} + +\item{XX}{The X'X matrix; useful for repeated runs where X'X stays the same} + +\item{Xy}{The X'y matrix; useful for repeated runs where X'y stays the same} + +\item{use.XX}{whether or not to compute X'X and return it} + +\item{use.Xy}{whether or not to compute X'y and return it} +} +\value{ +A "sparsestep" S3 object is returned, for which print, predict, +coef, and plot methods exist. It has the following items: +\item{call}{The call that was used to construct the model.} +\item{lambda}{The value(s) of lambda used to construct the model.} +\item{gamma0}{The gamma0 value of the model.} +\item{gammastop}{The gammastop value of the model} +\item{IMsteps}{The IMsteps value of the model} +\item{gammastep}{The gammastep value of the model} +\item{intercept}{Boolean indicating if an intercept was fitted in the +model} +\item{force.zero}{Boolean indicating if a force zero-setting was +performed.} +\item{threshold}{The threshold used for a forced zero-setting} +\item{beta}{The resulting coefficients stored in a sparse matrix format +(dgCMatrix). This matrix has dimensions nvar x nlambda} +\item{a0}{The intercept vector for each value of gamma of length nlambda} +\item{normx}{Vector used to normalize the columns of x} +\item{meanx}{Vector of column means of x} +\item{XX}{The matrix X'X if use.XX was set to TRUE} +\item{Xy}{The matrix X'y if use.Xy was set to TRUE} } \description{ Fits the entire regularization path for SparseStep using a -Golden Section search. +Golden Section search. Note that this algorithm is approximate, there is no +guarantee that the solutions _between_ induced values of lambdas do not +differ from those calculated. For instance, if solutions are calculated at +\eqn{\lambda_{i}}{\lambda[i]} and \eqn{\lambda_{i+1}}{\lambda[i+1]}, this +algorithm ensures that \eqn{\lambda_{i+1}}{\lambda[i+1]} has one more zero +than the solution at \eqn{\lambda_{i}}{\lambda[i]} (provided the recursion +depth is large enough). There is however no guarantee that there are no +different solutions between \eqn{\lambda_{i}}{\lambda[i]} and +\eqn{\lambda_{i+1}}{\lambda[i+1]}. This is an ongoing research topic. + +Note that this path algorithm is not faster than running the +\code{sparsestep} function with the same \code{\lambda} sequence. +} +\examples{ +x <- matrix(rnorm(100*20), 100, 20) +y <- rnorm(100) +pth <- sparsestep.path(x, y) +} +\author{ +Gertjan van den Burg (author and maintainer). } |
