Given previous matrices and a new observation, updates the matrices for ridge regression.
Arguments
- R_A
Matrix. Current matrix
R_A
for an arm. Must not contain NA values.- b
Numeric vector. Current vector
b
for an arm.- xs
Matrix. Covariates of shape
[A, p]
, whereA
is the number of observations andp
is the number of features. Must not contain NA values.- t
Integer. Current time or instance.
- yobs
Numeric vector. Observed outcomes, length
A
. Must not contain NA values.- alpha
Numeric. Ridge regression regularization parameter. Default is 1.
Examples
set.seed(123)
p <- 3
K <- 5
init <- ridge_init(p, K)
R_A <- init$R_A[[1]]
b <- init$b[1, ]
xs <- matrix(runif(10 * p), nrow = 10, ncol = p)
yobs <- runif(10)
t <- 1
alpha <- 1
updated <- ridge_update(R_A, b, xs, t, yobs[t], alpha)