sieve.sgd.predict {Sieve} | R Documentation |
Sieve-SGD makes prediction with new predictors.
Description
Sieve-SGD makes prediction with new predictors.
Usage
sieve.sgd.predict(sieve.model, X)
Arguments
sieve.model |
a list initiated using sieve.sgd.preprocess and sieve.sgd.solver. Check the documentation of sieve.sgd.preprocess for more information. |
X |
a data frame containing prediction features/ independent variables. |
Value
sieve.sgd.predict will update the given sieve.model input list.
inf.list |
In each entry of the list inf.list, the array prdy is the predicted outcome under the given hyperparameter combination. |
Examples
frho.para <- xdim <- 1 ##predictor dimension
frho <- 'additive' ###truth is a sum of absolute functions
type <- 'cosine' ###use cosine functions as the basis functions
#generate training data
TrainData <- GenSamples(s.size = 1e3, xdim = xdim,
frho.para = frho.para,
frho = frho, noise.para = 0.1)
#preprocess the model
sieve.model <- sieve.sgd.preprocess(X = TrainData[,2:(xdim+1)],
type = type,
s = c(1,2),
r0 = c(0.5, 2, 4),
J = c(1, 4, 8))
##train the model
sieve.model <- sieve.sgd.solver(sieve.model = sieve.model,
X = TrainData[,2:(xdim+1)],
Y = TrainData[,1])
##generate new data
NewData <- GenSamples(s.size = 5e2, xdim = xdim,
frho.para = frho.para,
frho = frho, noise.para = 0.1)
sieve.model <- sieve.sgd.predict(sieve.model, X = NewData[, 2:(xdim+1)])
plot(NewData[, 2:(xdim+1)], sieve.model$best_model$prdy)
[Package Sieve version 2.1 Index]