Description Usage Arguments Value Examples
View source: R/predict.graper.R
Function to predict the response on a new data set using a fitted graper model.
1 2 3 |
object |
fitted graper model as obtained from |
newX |
Predictor matrix of size n_test
(number of new test samples) x p (number of predictors)
(same feature structure as used in |
type |
type of prediction returned, either:
|
... |
other arguments |
A vector with predictions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # create data
dat <- makeExampleData()
# split data into train and test sets of equal size
ntrain <- dat$n / 2
# fit the model to the train data
fit <- graper(dat$X[seq_len(ntrain), ],
dat$y[seq_len(ntrain)], dat$annot)
# make predictions on the test data
ypred <- predict(fit, dat$X[seq_len(ntrain) + dat$n / 2, ])
# create data for logistic regression
dat <- makeExampleData(response="bernoulli")
# split data into train and test sets of equal size
ntrain <- dat$n / 2
# fit the graper model for a logistic model
fit <- graper(dat$X[seq_len(ntrain), ],
dat$y[seq_len(ntrain)],
dat$annot, family="binomial")
# make predictions on the test data
ypred <- predict(fit, dat$X[seq_len(ntrain) + dat$n / 2, ], type = "inRange")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.