Description Usage Arguments Value Examples
Makes a prediction on new data for a given fitted jous
model.
1 2 |
object |
An object of class |
X |
A design matrix of predictors. |
type |
The type of prediction to return. If |
... |
... |
Returns a vector of class predictions if type="response"
, or a
vector of class probabilities p(y=1|x) if type="prob"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
# Generate data from Friedman model #
set.seed(111)
dat = friedman_data(n = 500, gamma = 0.5)
train_index = sample(1:500, 400)
# Apply jous to adaboost classifier
class_func = function(X, y) adaboost(X, y, tree_depth = 2, n_rounds = 100)
pred_func = function(fit_obj, X_test) predict(fit_obj, X_test)
jous_fit = jous(dat$X[train_index,], dat$y[train_index], class_func,
pred_func, keep_models=TRUE)
# get class prediction
yhat = predict(jous_fit, dat$X[-train_index, ])
# get probability estimate
phat = predict(jous_fit, dat$X[-train_index, ], type="prob")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.