Skip to contents

Predicts outcome

Usage

# S3 method for class 'sparselink'
predict(object, newx, weight = NULL, ...)

Arguments

object

object of class `sparselink`

newx

features: matrix with \(n\) rows (samples) and \(p\) columns (variables) for multi-task learning; list of \(q\) matrices with \(n_k\) rows (samples) and \(p\) columns (variables) for transfer learning, for each \(k\) in \(1,\ldots,q\)

weight

experimental argument: numeric vector of length 2, with the first entry for the internal weight, and the second entry for the external weight, overwrites the cross-validated weights

...

(not applicable)

Value

Returns predicted values or predicted probabilities. The output is a list of \(q\) column vectors of length \(n_k\) for \(k\) in \(1,\ldots,q\).

References

Armin Rauschenberger, Petr N. Nazarov, Enrico Glaab (2025). "Estimating sparse regression models in multi-task learning and transfer learning through adaptive penalisation". Under revision. https://hdl.handle.net/10993/63425

Examples

family <- "gaussian"
data <- sim.data.transfer(family=family)
#data <- sim.data.multiple(family=family)
object <- sparselink(x=data$X_train,y=data$y_train,family=family)
#> alpha.init=0.95, alpha=1, trial=FALSE, type=exp
#> mode: transfer learning
y_hat <- predict(object=object,newx=data$X_test)