Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 879bbd9
  • /
  • man
  • /
  • foba.Rd
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:628f3d0cf8df0854abfdead41f1600064522a2e8
directory badge
swh:1:dir:64ba1c492557c9278df0e95dc1aba37a100a45c8

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
foba.Rd
\name{foba}
\alias{foba}
\title{
Greedy variable selection for ridge regression
}
\description{
Variable Selection for Ridge Regression using Forward Greedy, Backward Greedy, and Adaptive Forward-Backward Greedy (FoBa) Methods
}
\usage{
foba(x,y, type=c("foba","foba.aggressive", "foba.conservative", "forward","backward"), steps=0, intercept=TRUE, nu=0.5,lambda=1e-10) 
}
\arguments{
\item{x}{
matrix of predictors
}
\item{y}{
response 
}
\item{type}{
One of  "foba", "foba.aggressive", "foba.conservative", "forward", or "backward". The names can
be abbreviated to any unique substring. Default is "foba".
}
\item{steps}{
Number of greedy (forward+backward) steps. Default is the number of variables for forward and backward, and twice the number of variables for foba.
}
\item{intercept}{
If TRUE, an intercept is included in the model (and not penalized),
otherwise no intercept is included. Default is TRUE.
}
\item{nu}{
In range (0,1): controls how likely to take a backward step (more likely when nu is larger). Default is 0.5.
}
\item{lambda}{
Regularization parameter for ridge regression. Default is 1e-5.
}
}

\value{
A "foba" object is returned, which contains the following components:
\item{call}{ The function call resulting to the object}
\item{type}{ Which variable selection method is used}
\item{path}{ The variable selection path: a sequence of variable addition/deletions}
\item{beta}{ Coefficients (ridge regression solution) at each step with selected features}
\item{meanx}{ Zero if intercept=FALSE, and the mean of x if intercept=TRUE}
\item{meany}{ Zero if intercept=FALSE, and the mean of y if intercept=TRUE}
}
\details{
FoBa for least squares regression is described in [Tong Zhang (2008)].
This implementation supports ridge regression.
The "foba" method takes a backward step when the ridge penalized risk increase is less than nu times the ridge penalized risk reduction in the corresponding backward step. The "foba.conservative" method takes a backward step when the risk increase is less than nu times the smallest risk reduction in all previous forward steps. The "foba.aggressive" method takes a backward step when the cumulative risk changes in backward step is less than nu times the changes in the forward steps.
}
\references{
Tong Zhang (2008) "Adaptive Forward-Backward Greedy Algorithm for Learning Sparse Representations", Rutgers Technical Report (long version). 

Tong Zhang (2008) "Adaptive Forward-Backward Greedy Algorithm for Sparse Learning with Linear Models", NIPS'08 (short version).
}

\author{Tong Zhang}
\seealso{
print.foba and predict.foba methods for foba
}

\examples{
data(boston)

model.foba <- foba(boston$x,boston$y,steps=20)
print(model.foba)

model.foba.a <- foba(boston$x,boston$y,type="foba.a",steps=20) # Can use abbreviations
print(model.foba.a)

model.for <- foba(boston$x,boston$y,type="for",steps=20) 
print(model.for)

model.back <- foba(boston$x,boston$y,type="back") # Use only first 20 variables
print(model.back)


}

\keyword{regression}
\keyword{models}
\keyword{optimize}




back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API