R High Performance Programming by unknow

R High Performance Programming by unknow

Author:unknow
Language: eng
Format: epub
Publisher: Packt Publishing


Indeed the time needed by the second approach is longer. We can speed this up by parallelizing the code, for example by substituting lapply() with parLApply() of the parallel package (see Chapter 8, Multiplying Performance with Parallel Computing). In practice, for a specific case of finding the closest pair of observations efficiently without storing a full distance matrix, we can leverage optimized k-nearest neighbor functions, like the knn() function in the FNN package. Where such an alternative optimized package is unavailable, the approach of calculating values on the fly as illustrated in the preceding code is useful to reduce memory use.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.