Skip to main content

Computes distance covariances/correlations between vectors and distance covariance/correlation matrices for data matrices

Project description

distance correlation

Distance correlation is a measure of dependence between two vectors. It's particularly known for the nice property that two uncorrelated vectors are guaranteed to be independent.

In slightly more detail: given X and Y random vectors, distance covariance is a metric (called the energy distance) of how distant is the actual joint distribution (X,Y) from the alternate distribution that would hold if X and Y were independent. Wikipedia has the technical details, but to illustrate its main properties we'll borrow the following chart, with depicts a few point cloud-type datasets and their distance correlation:

Distance Correlation - examples

  • Unlike Pearson correlation, distance correlation is bounded between 0 and 1, and doesn't have an interpretation of linear directionality, Therefore negatively sloped lines have perfect correlation = 1.
  • Distance correlation is quite adept at detecting nonlinear structures. The Pearson correlation for all the charts in the third row is 0,

I've always been interested in distance correlation and tried to use it in my datasets, but it's quite computation-intensive in ways that aren't easy to vectorize for numpy optimizations. This package relies on a custom-written C++ extension that leverages pybind11 for Python integration and the excellent Eigen3 library for C++ linear algebra that saves the heartache of manual memory management.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

distance_correlation-0.0.2.tar.gz (9.1 kB view details)

Uploaded Source

File details

Details for the file distance_correlation-0.0.2.tar.gz.

File metadata

  • Download URL: distance_correlation-0.0.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for distance_correlation-0.0.2.tar.gz
Algorithm Hash digest
SHA256 93475b8d41593ed5e274229b8baf074561c56ffde29c639396860214f703ce03
MD5 6c01935143fc435c9b0a01062efe4fe5
BLAKE2b-256 e642e61b7293d60f616197ebae424c78974736b26632138c89e15ffc8a2cde00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page