Speed up GRDA's cross-validation function
ramhiser opened this issue · comments
John Ramey commented
Copied from previous regdiscrim
package
John Ramey commented
For a cross-validation fold, there is no reason to compute XU = X_k %*% U_1
for each set of tuning parameters. This is very likely the most computationally expensive operation, given that X_k
is an n_k
by p
matrix and U_1
is a p
by q
matrix. The subsequent operations, i.e., calculating Q
and W_inv
, should be lightning fast because XU
is n_k
by q
.
Hence, the cross-validation function should simply update the estimates rather than recomputing them each time.