Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 852 Bytes
38f62b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pandas as pd
from datasets import load_dataset


def get_stats():
    relation = []
    size = []
    data = load_dataset("relbert/conceptnet")
    splits = data.keys()
    for split in splits:
        df = data[split].to_pandas()
        size.append({
            "number of pairs": len(df),
            "number of unique relation types": len(df["relation"].unique())
        })
        relation.append(df.groupby('relation')['head'].count().to_dict())
    relation = pd.DataFrame(relation, index=[f"number of pairs ({s})" for s in splits]).T
    relation = relation.fillna(0).astype(int)
    size = pd.DataFrame(size, index=splits).T
    return relation, size

df_relation, df_size = get_stats()
print(f"\n- Number of instances\n\n {df_size.to_markdown()}")
print(f"\n- Number of pairs in each relation type\n\n {df_relation.to_markdown()}")