Diversity#

Functions to measure diversity among deliberating agents. Interestingly, many functions in the module have a common abstract ancestor function ([Tuomisto2010]), but are implemented here in a rather pedestrian way for simplicty.

Shannon index and derivatives#

taupy.analysis.diversity.Shannon_index(clusters)[source]#

The Shannon index describes the uncertainty of predicting the cluster that the belief system of a randomly drawn agent belongs to.

(Note that math.log defaults to base e, and so returns ln here – although sometimes a different base is used for the Shannon index.)

taupy.analysis.diversity.normalised_Shannon_index(clusters)[source]#

Simpson index and derivatives#

taupy.analysis.diversity.Simpson_index(clusters)[source]#

The Simpson index of diversity equals the probability that the belief systems of two randomly chosen agents belong to the same cluster.

taupy.analysis.diversity.inverse_Simpson_index(clusters)[source]#

Simpson’s inverse index is simply dubbed “diversity index” in Page’s “Diversity and complexity” ([Page2011], pp. 73–76). Political scientists call it “effective number of parties”, and it is known as Herfindahl index in economics.

taupy.analysis.diversity.Gini_Simpson_index(clusters)[source]#

Estimates the probability that the belief systems of two randomly drawn agents are clustered into different clusters (“inter-type encounters”).

Attribute diversity#

taupy.analysis.diversity.attribute_diversity_page(positions)[source]#

Page’s ([Page2011], pp. 73–76)attribute diversity is equal to the number of distinct attributes in the population. We interpret it to count the number of distinct truth-value attributions: a population in which both {p1: True} and {p1: False} are maintained is more diverse then a population in which just {p1: True} is maintained.

taupy.analysis.diversity.normalised_attribute_diversity_page(positions, sentencepool, truth_values=[True, False])[source]#

Page’s attribute diversity, normalised to the amount of truth-value attributions possible without any constraints (number of sentences * allowed truth values). This normalised diversity measure is not weighted, since all attributes contribute to it equally.