We are hiring ! See our job offers.
Raw File
Tip revision: ee9dcf0fe7e6add585e0389170265c28adaad73a authored by Tong Zhang on 15 October 2008, 00:00:00 UTC
Tip revision: ee9dcf0
Make predictions or extract coefficients from a fitted foba model
foba() returns a path of variable addition and deletion.
predict.foba() allows one to extract a prediction, or coefficients at any desired sparsity level.
predict.foba(object, newx, k, type=c("fit","coefficients"),...)
A fitted foba object.
If type="fit", then newx should be the x values at which the fit is required.
If type="coefficients", then newx can be omitted.
The sparsity level. That is, the number of selected variables for the fitted model.
If type="fit", predict returns the fitted values. If
type="coefficients", predict returns the coefficients.
Abbreviations allowed.
\item{...}{further arguments passed to or from other methods.}
Return either a "coefficients" object or a "fitted value" object,
at the desired sparsity level.

A coefficients object is a list containing the following components:
coefficients of ridge regression solution using selected.variables
the intercept value 
variables with non-zero coefficients

A "fitted value" object contains the following additional component:
the predicted response for the data newx

FoBa for least squares regression is described in [Tong Zhang (2008)].
This implementation supports ridge regression.
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}
print.foba and foba


model <- foba(boston$x,boston$y,s=20,nu=0.9)

### make predictions at the values in x, at sparsity level 5

py <- predict(model, boston$x, k=5, type="fit")

print(paste("mean squared error =", mean((py$fit-boston$y)^2)))

### extract the coefficient vector at sparsity level 5
coef <- predict(model, k=5, type="coef")
print("top five variables:")


back to top