Learn R Programming

RcppDPR (version 0.1.10)

predict.DPR_Model: Use a DPR model to predict results from new data

Description

Use a DPR model to predict results from new data

Usage

# S3 method for DPR_Model
predict(object, newdata, ...)

Value

returns Numeric vector of predictions

Arguments

object

an object of class DPR_Model

newdata

Numeric matrix representing the input to the model

...

ignored args.

Examples

Run this code
n <- 500
p <- 10775
file_path_x <- system.file("extdata", "data/in/x.rds", package = "RcppDPR")
file_path_y <- system.file("extdata", "data/in/y.rds", package = "RcppDPR")
file_path_w <- system.file("extdata", "data/in/w.rds", package = "RcppDPR")
x = readRDS(file_path_x)
y = readRDS(file_path_y)
w = readRDS(file_path_w)
dpr_model <- fit_model(y, w, x, fitting_method = "VB")
new_x <- matrix(rnorm(n = n * p, mean = 0, sd = 1), nrow = n, ncol = p)
new_y <- predict(dpr_model, new_x)

Run the code above in your browser using DataLab