ontometer_corpus.metrics.growth¶
Growth of a specialisation network: survival of leaves and attachment nulls.
When a network of ontologies grows, an ontology that nothing specialises (a terminal ontology, a leaf of the network) becomes a branch the first time a newcomer specialises one of its classes. Specialiser counts only grow, so growth of one ontology is not informative by itself; these functions measure the rate and the concentration of that growth: how fast leaves turn into branches (survival), and whether newcomers spread over the existing ontologies or concentrate on a few (attachment nulls).
Needs the corpus extra (numpy).
Classes¶
AttachmentNull
dataclass
¶
Outcome of re-targeting every specialisation at random.
Attributes:
| Name | Type | Description |
|---|---|---|
n_targets |
ndarray
|
per replicate, the number of distinct ontologies specialised at least once — the number of leaves that became branches. |
top_share |
ndarray
|
per replicate, the share of all specialisations received by the most specialised tenth of targets. |
Source code in ontometer_corpus/metrics/growth.py
Functions:¶
kaplan_meier(durations, observed)
¶
Kaplan–Meier survival estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
durations
|
ndarray
|
time to the event, or to censoring when the event was not observed. |
required |
observed
|
ndarray
|
True where the event happened at |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
ndarray
|
probability of surviving past each of them. |
Source code in ontometer_corpus/metrics/growth.py
survival_at(times, surv, t)
¶
Value of a Kaplan–Meier step function at t.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
ndarray
|
event times, as :func: |
required |
surv
|
ndarray
|
survival after each event time. |
required |
t
|
float
|
time at which to read the step function. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The survival probability at |
Source code in ontometer_corpus/metrics/growth.py
top_decile_share(in_degree)
¶
Share of the total received by the top tenth of nodes with any in-degree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_degree
|
ndarray
|
in-degree (or any non-negative count) per node. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The share in |
Source code in ontometer_corpus/metrics/growth.py
attachment_null(edge_time, edge_child, birth, *, preferential, reps, seed=0)
¶
Replay the arrival of specialisations with random targets.
Each specialisation i arrives at edge_time[i] from edge_child[i]
and, in the null, lands on an ontology already born at that time other
than the child itself and other than a target the child already chose —
uniformly, or with probability proportional to one plus the number of
specialisations the target has received so far (preferential attachment).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_time
|
ndarray
|
arrival time of each specialisation (distinct child–target pairs). |
required |
edge_child
|
ndarray
|
node index of the specialising ontology. |
required |
birth
|
ndarray
|
birth time per node; NaN nodes are never targets. |
required |
preferential
|
bool
|
attach in proportion to |
required |
reps
|
int
|
number of replicates. |
required |
seed
|
int
|
random seed. |
0
|
Returns:
| Type | Description |
|---|---|
AttachmentNull
|
Per replicate, the number of distinct targets and the top-decile share |
AttachmentNull
|
of the specialisations received. A specialisation with no eligible |
AttachmentNull
|
target at its arrival time is dropped. |