The predict function can be rather slow with many predictions.
For example, I think the following may speed up the function, but other improvements are welcome.
- add a functionality to the predict function to parallelize the main loop (which starts at line 201) e.g., using
parallel::mclapply instead of the for loop and predict could have an extra argument cores.
- or try to reformat the code avoiding a loop entirely (maybe add extra dimension for
num_preds and do as many matrix operations as possible)
The predict function can be rather slow with many predictions.
For example, I think the following may speed up the function, but other improvements are welcome.
parallel::mclapplyinstead of the for loop and predict could have an extra argumentcores.num_predsand do as many matrix operations as possible)