pairwisedist.pairwisedist.pearson_distance

pairwisedist.pairwisedist.pearson_distance(data: ndarray, rowvar: bool = True, similarity: bool = False) ndarray

Calculates the pairwise Pearson-correlation distance matrix for a given array of n samples by p features. The Pearson-correlation distance ranges between 0 (linear correlation coefficient is 1) and 1 (linear correlation coefficient is -1). :param data: an n-by-p numpy array of n samples by p features, to calculate pairwise distance on. :type data: np.ndarray :param rowvar: If True, calculates the pairwise distance between the rows of ‘data’. If False, calculate the pairwise distance between the columns of ‘data’. :type rowvar: bool (default=True) :param similarity: If False, returns a pairwise distance matrix (0 means closest, 1 means furthest). If True, returns a pairwise similarity matrix (1 means most similar, 0 means most different). :type similarity: bool (default=False) :return: an n-by-n numpy array of pairwise Pearson-correlation dissimilarity scores. :rtype: np.ndarray