Comparison.score.rank_divergence
Comparison.score.rank_divergence ¶
Calculates the rank-turbulence divergence between the reference and comparison corpora.
Example
Rank-turbulence divergence compares corpora by the ranks of their tokens when ordered by relative frequency. When \(\alpha > 0\), the contribution \(\delta_\tau\) of a token \(\tau\) is:
where \(r_\tau^{(R)}\) and \(r_\tau^{(C)}\) are the ranks of \(\tau\) in the reference corpus \(R\) and the comparison corpus \(C\), and \(\mathcal{N}_\alpha\) is a normalization constant based on \(\alpha\). When \(\alpha = 0\), the contribution is instead \(\left| \ln \left( r_\tau^{(R)} / r_\tau^{(C)} \right) \right| / \mathcal{N}_0\).
For more details, including the effect of tuning \(\alpha\), see Divergences.
Reference
For details, see the following paper:
Dodds, P. S., Minot, J. R., Arnold, M. V., Alshaabi, T., Adams, J. L., Dewhurst, D. R., Gray, T. J., Frank, M. R., Reagan, A. J., & Danforth, C. M. (2023). Allotaxonometry and rank-turbulence divergence: A universal instrument for comparing complex systems. EPJ Data Science, 12(1), 37.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
Order of the rank divergence. Larger values place more weight on common tokens, and smaller values place more weight on rare tokens |
1.0
|
Returns:
| Type | Description |
|---|---|
Comparison
|
A new |