Description Usage Arguments Details Value Author(s) References See Also Examples
foba() returns a path of variable addition and deletion. predict.foba() allows one to extract a prediction, or coefficients at any desired sparsity level.
1 | predict.foba(object, newx, k, type=c("fit","coefficients"),...)
|
object |
A fitted foba object. |
newx |
If type="fit", then newx should be the x values at which the fit is required. If type="coefficients", then newx can be omitted. |
k |
The sparsity level. That is, the number of selected variables for the fitted model. |
type |
If type="fit", predict returns the fitted values. If type="coefficients", predict returns the coefficients. Abbreviations allowed. |
... |
further arguments passed to or from other methods. |
FoBa for least squares regression is described in [Tong Zhang (2008)]. This implementation supports ridge regression.
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 |
coefficients of ridge regression solution using selected.variables |
intercept |
the intercept value |
selected.variables |
variables with non-zero coefficients |
A "fitted value" object contains the following additional component:
fit |
the predicted response for the data newx |
Tong Zhang
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).
print.foba and foba
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(boston)
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:")
coef$selected.variables
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.