get_relation_functionality_df
- get_relation_functionality_df(*, dataset: Dataset, parts: Collection[str] | None = None, add_labels: bool = True) DataFrame [source]
Calculate the functionality and inverse functionality score per relation.
The (inverse) functionality was proposed in [wang2018]. It is defined as the number of unique head (tail) entities divided by the of triples in which the relation occurs. Thus, its value range is [0, 1]. Smaller values indicate that entities usually have more than one outgoing (incoming) triple with the corresponding relation type. Hence, the score is related to the relation cardinality types.
- Parameters:
dataset (Dataset) – The dataset to investigate.
parts (Collection[str] | None) – Only use certain parts of the dataset, e.g., train triples. Defaults to using all triples, i.e. {“training”, “validation”, “testing}.
add_labels (bool) – Whether to add relation labels (if available).
- Returns:
A dataframe with columns (relation_id | functionality | inverse functionality)
- Return type:
DataFrame
[wang2018]Wang, Z., et al. (2018). Cross-lingual Knowledge Graph Alignment via Graph Convolutional Networks. Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, 349–357.