codependence
Concept Overview
Section titled “Concept Overview”Dependence measures that survive non-linearity, which Pearson correlation does not. Distance correlation is zero only under genuine independence. Mutual information and variation of information are information-theoretic and need a binning choice, which get_optimal_number_of_bins supplies. The angular distances turn a correlation into a proper metric — sqrt(2(1-rho)) and its absolute and squared variants — which is what hierarchical clustering needs in order to be well posed at all.
When to Use
Section titled “When to Use”Use it upstream of any clustering or feature-pruning step: hrp, hcaa and onc all consume a distance matrix, and feeding them raw correlation silently assumes the relationship is linear. Use distance correlation when you suspect a non-monotone relationship, and variation of information when you want a true metric on discrete variables. Bin selection materially changes mutual-information estimates, so fix it explicitly and record it alongside the result.
Mathematical Foundations
Section titled “Mathematical Foundations”Mutual Information
Section titled “Mutual Information”
Variation of Information
Section titled “Variation of Information”
Usage Examples
Section titled “Usage Examples”Distance correlation between series
Section titled “Distance correlation between series”use openquant::codependence::distance_correlation;
let x = vec![1.0, 2.0, 3.0, 4.0];let y = vec![1.1, 1.9, 3.2, 3.8];let dcor = distance_correlation(&x, &y)?;API Reference
Section titled “API Reference”Python API
Section titled “Python API”codependence.angular_distancecodependence.absolute_angular_distancecodependence.squared_angular_distancecodependence.distance_correlationcodependence.get_optimal_number_of_binscodependence.get_mutual_infocodependence.variation_of_information_score
Rust API
Section titled “Rust API”distance_correlationget_mutual_infovariation_of_information_scoreangular_distance
Risk Notes and Caveats
Section titled “Risk Notes and Caveats”- Use with clustering and feature pruning workflows.
- Bin selection materially impacts MI estimates.