| predict.orthoMTL | R Documentation |
Generate predictions from a fitted orthoMTL model for new
observations. In survival mode, predictions are projected onto the
non-negative non-increasing space to ensure monotonicity across tasks.
## S3 method for class 'orthoMTL'
predict(object, newdata, type = c("link", "response", "class"), ...)
object |
A fitted model object of class |
newdata |
A numeric matrix of new observations with dimensions
|
type |
Character; scale of the returned predictions. One of:
|
... |
Additional arguments (currently ignored). |
If the fitted object contains feature_names (i.e., the training
matrix X had column names), newdata columns are aligned
to match. Missing features cause an error. Extra features trigger a
warning and are dropped.
In survival mode (object$hyperparameters$survival == TRUE),
each row of the raw prediction matrix is projected via
nnmaxheap_C() to enforce non-negative, non-increasing values
across tasks (time thresholds).
A numeric matrix of predictions with dimensions
n_new x n_tasks. Column names correspond to task names
if available.
Vervier, K., Mahe, P., d'Aspremont, A., Veyrieras, J.-B., and Vert, J.-P. (2014). On Learning Matrices with Orthogonal Columns or Disjoint Supports. ECML-PKDD 2014. https://hal.science/hal-00985654
set.seed(42)
n <- 100; p <- 10; n_tasks <- 3
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", seq_len(p))
W_true <- qr.Q(qr(matrix(rnorm(p * n_tasks), p, n_tasks)))
Y <- X %*% W_true + matrix(rnorm(n * n_tasks), n) * 0.1
K <- matrix(1, n_tasks, n_tasks); diag(K) <- 0.5
fit <- orthoMTL(X, Y, lambda = 1e-3, K = K, disjoint = FALSE)
X_new <- matrix(rnorm(20 * p), 20, p)
colnames(X_new) <- paste0("V", seq_len(p))
preds <- predict(fit, newdata = X_new)
dim(preds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.