View source: R/cossonet.predict.R
cossonet.predict | R Documentation |
cossonet.predict
predicts predictive values for new data based on an object from the cossonet
function.The function cossonet.predict
predicts predictive values for new data based on an object from the cossonet
function.
cossonet.predict(model, testx)
model |
The fitted cossonet object. |
testx |
The new data set to be predicted. |
A list of predicted values for the new data set.
set.seed(20250101)
tr = data_generation(n = 200, p = 20, SNR = 9, response = "continuous")
tr_x = tr$x
tr_y = tr$y
te = data_generation(n = 1000, p = 20, SNR = 9, response = "continuous")
te_x = te$x
te_y = te$y
# Fit the model
fit = cossonet(tr_x, tr_y, family = 'gaussian', gamma = 0.95, kernel = "spline", scale = TRUE,
lambda0 = exp(seq(log(2^{-4}), log(2^{0}), length.out = 20)),
lambda_theta = exp(seq(log(2^{-8}), log(2^{-6}), length.out = 20))
)
# Predict new dataset
pred = cossonet.predict(fit, te_x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.