simpson_index
cellseg_gsontools.diversity.simpson_index(counts)
¶
Compute the Simpson diversity index on a count vector.
Note
Simpson diversity index is a quantitative measure that reflects how many different types (such as species) there are in a dataset (a community). It is a probability measure, when it is low, the greater the probability that two randomly selected individuals will be the same species. - A. Wilson, N. Gownaris
Simpson index: $$ D = 1 - \sum_{i=1}^n \left(\frac{n_i}{N}\right)^2 $$
where \(n_i\) is the count of species \(i\) and \(N\) is the total count of species.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
counts |
Sequence
|
A count vector/list of shape (C, ). |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The computed Simpson diversity index. |