View source: R/constraint_matrices.R
| create_constraint_matrix | R Documentation |
Builds a square constraint matrix K encoding the prior belief
that temporally distant tasks should have more orthogonal coefficients.
Off-diagonal entries accumulate weight proportional to the distance
between task indices, implementing a diffusion-like pattern.
create_constraint_matrix(numTasks, diag_val = 0.5)
numTasks |
An integer specifying the number of tasks. |
diag_val |
A numeric value for the diagonal of |
This matrix is passed to orthoMTL via the K
argument to control the orthogonality penalty between tasks.
The construction rule: for each distance level h from
1 to numTasks, add 1 to all entries where
|row - col| > h. This produces a matrix where nearby tasks
(adjacent thresholds) share more support, while distant tasks
are pushed toward orthogonality.
For survival analysis with time thresholds, this encodes the assumption that the set of predictive features changes gradually over time rather than abruptly.
A numeric square matrix of dimensions
numTasks x numTasks. Off-diagonal entry K[i,j]
is larger when tasks i and j are further apart.
Diagonal entries are set to diag_val.
cv_orthoMTL
# 5-task constraint matrix
K <- create_constraint_matrix(5)
K
# Override diagonal for a specific penalty balance
K <- create_constraint_matrix(7, diag_val = 6)
K
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.