ramhiser / sparsediscrim

Sparse and Regularized Discriminant Analysis in R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Speed up GRDA's cross-validation function

ramhiser opened this issue · comments

Copied from previous regdiscrim package

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.