Compute spearman correlation coefficient with Matlab/CUDA
Seongho Kim, Ming Ouyang, Xiang Zhang · 2012
Given a data matrix where the rows are entities and the columns are features, researchers often want to compute the pairwise distances among the entities. Some common choices of distances are Euclidean distance, Manhattan distance, Chebyshev distance, and Canberra distance. Pearson and Spearman correlation coefficients, with a range from -to 1, can be used to define a distance: 1 minus the coefficient. Matlab is widely used in science and engineering fields for technical computing, and it provides a function in its statistics toolbox to calculate the pairwise distances, which takes a long time when the data matrix is large. Graphics processing units have become powerful co-processors to the CPUs. Nvidia GPUs can be programmed by the CUDA language. The present work studies CUDA implementation of Spearman correlation coefficient that can be called from Matlab to speed up the computation of pairwise distances. Speedups from 7.1 to 28.9 folds are achieved.