Update language-metric-data.py
Browse files- language-metric-data.py +18 -34
language-metric-data.py
CHANGED
|
@@ -22,7 +22,7 @@ import datasets
|
|
| 22 |
|
| 23 |
# _LICENSE = "Specify your license here."
|
| 24 |
|
| 25 |
-
class
|
| 26 |
VERSION = datasets.Version("1.0.0")
|
| 27 |
|
| 28 |
def _info(self):
|
|
@@ -32,24 +32,13 @@ class WholeDataset(datasets.GeneratorBasedBuilder):
|
|
| 32 |
"average_distances_matrix": datasets.Sequence(
|
| 33 |
datasets.Sequence(datasets.Value("float"))
|
| 34 |
),
|
| 35 |
-
# "distances_matrices": datasets.Sequence(
|
| 36 |
-
# datasets.Features({
|
| 37 |
-
# "dataset_name": datasets.Value("string"),
|
| 38 |
-
# "models": datasets.Sequence(
|
| 39 |
-
# datasets.Features({
|
| 40 |
-
# "model_name": datasets.Value("string"),
|
| 41 |
-
# "matrix": datasets.Sequence(
|
| 42 |
-
# datasets.Sequence(datasets.Value("float"))
|
| 43 |
-
# )
|
| 44 |
-
# })
|
| 45 |
-
# )
|
| 46 |
-
# })
|
| 47 |
-
# )
|
| 48 |
"distances_matrices": datasets.Sequence(
|
| 49 |
datasets.Features({
|
| 50 |
-
datasets.Value("string")
|
|
|
|
| 51 |
datasets.Features({
|
| 52 |
-
datasets.Value("string")
|
|
|
|
| 53 |
datasets.Sequence(datasets.Value("float"))
|
| 54 |
)
|
| 55 |
})
|
|
@@ -95,27 +84,22 @@ class WholeDataset(datasets.GeneratorBasedBuilder):
|
|
| 95 |
# Convert the nested dict structure into a list of dictionaries.
|
| 96 |
# Each outer key corresponds to a dataset name.
|
| 97 |
# Each inner dict is a mapping from model name to a NumPy matrix.
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
# })
|
| 111 |
-
# distances_matrices_list.append({
|
| 112 |
-
# "dataset_name": dataset_name,
|
| 113 |
-
# "models": models_list
|
| 114 |
-
# })
|
| 115 |
|
| 116 |
# Yield a single example containing the whole dataset.
|
| 117 |
yield 0, {
|
| 118 |
"languages_list": languages_list,
|
| 119 |
"average_distances_matrix": average_distances_matrix,
|
| 120 |
-
"distances_matrices":
|
| 121 |
}
|
|
|
|
| 22 |
|
| 23 |
# _LICENSE = "Specify your license here."
|
| 24 |
|
| 25 |
+
class DistancesDataset(datasets.GeneratorBasedBuilder):
|
| 26 |
VERSION = datasets.Version("1.0.0")
|
| 27 |
|
| 28 |
def _info(self):
|
|
|
|
| 32 |
"average_distances_matrix": datasets.Sequence(
|
| 33 |
datasets.Sequence(datasets.Value("float"))
|
| 34 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
"distances_matrices": datasets.Sequence(
|
| 36 |
datasets.Features({
|
| 37 |
+
"dataset_name": datasets.Value("string"),
|
| 38 |
+
"models": datasets.Sequence(
|
| 39 |
datasets.Features({
|
| 40 |
+
"model_name": datasets.Value("string"),
|
| 41 |
+
"matrix": datasets.Sequence(
|
| 42 |
datasets.Sequence(datasets.Value("float"))
|
| 43 |
)
|
| 44 |
})
|
|
|
|
| 84 |
# Convert the nested dict structure into a list of dictionaries.
|
| 85 |
# Each outer key corresponds to a dataset name.
|
| 86 |
# Each inner dict is a mapping from model name to a NumPy matrix.
|
| 87 |
+
distances_matrices_list = []
|
| 88 |
+
for dataset_name, models_dict in distances_matrices.items():
|
| 89 |
+
models_list = []
|
| 90 |
+
for model_name, matrix in models_dict.items():
|
| 91 |
+
models_list.append({
|
| 92 |
+
"model_name": model_name,
|
| 93 |
+
"matrix": matrix
|
| 94 |
+
})
|
| 95 |
+
distances_matrices_list.append({
|
| 96 |
+
"dataset_name": dataset_name,
|
| 97 |
+
"models": models_list
|
| 98 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# Yield a single example containing the whole dataset.
|
| 101 |
yield 0, {
|
| 102 |
"languages_list": languages_list,
|
| 103 |
"average_distances_matrix": average_distances_matrix,
|
| 104 |
+
"distances_matrices": distances_matrices_list
|
| 105 |
}
|