ramhiser / sparsediscrim

Sparse and Regularized Discriminant Analysis in R
Other
15 stars 5 forks source link

Speed up GRDA's cross-validation function #18

Closed ramhiser closed 11 years ago

ramhiser commented 11 years ago

Copied from previous regdiscrim package

ramhiser commented 11 years ago

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.