cossonet.predict {cossonet}R Documentation

The function cossonet.predict predicts predictive values for new data based on an object from the cossonet function.

Description

The function cossonet.predict predicts predictive values for new data based on an object from the cossonet function.

Usage

cossonet.predict(model, testx)

Arguments

model

The fitted cossonet object.

testx

The new data set to be predicted.

Value

A list of predicted values for the new data set.

Examples


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)


[Package cossonet version 1.0 Index]