predict.foba
From foba v0.1
by Tong Zhang
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.
 Keywords
 methods, regression
Usage
predict.foba(object, newx, k, type=c("fit","coefficients"),...)
Arguments
 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.
Details
FoBa for least squares regression is described in [Tong Zhang (2008)]. This implementation supports ridge regression.
Value

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 nonzero coefficients A "fitted value" object contains the following additional component:
 fit
 the predicted response for the data newx
References
Tong Zhang (2008) "Adaptive ForwardBackward Greedy Algorithm for Learning Sparse Representations", Rutgers Technical Report (long version).
Tong Zhang (2008) "Adaptive ForwardBackward Greedy Algorithm for Sparse Learning with Linear Models", NIPS'08 (short version).
See Also
print.foba and foba
Examples
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$fitboston$y)^2)))
### extract the coefficient vector at sparsity level 5
coef < predict(model, k=5, type="coef")
print("top five variables:")
coef$selected.variables
Community examples
Looks like there are no examples yet.