Datasets:
ArXiv:
License:
Merge branch 'main' of hf.co:datasets/philipphager/baidu-ultr_baidu-mlm-ctr
Browse files- README.md +4 -4
- baidu-ultr_baidu-mlm-ctr.py +18 -13
README.md
CHANGED
@@ -65,8 +65,8 @@ Each row of the click / annotation dataset contains the following attributes. Us
|
|
65 |
| serp_height | Tensor[int32] | Pixel height of a document on the screen |
|
66 |
| slipoff_count_after_click | Tensor[int32] | Number of times a document was scrolled off the screen after previously clicking on it |
|
67 |
| bm25 | Tensor[float32] | BM25 score for documents |
|
68 |
-
|
|
69 |
-
|
|
70 |
| tf_idf | Tensor[float32] | TF-IDF score for documents |
|
71 |
| tf | Tensor[float32] | Term frequency for documents |
|
72 |
| idf | Tensor[float32] | Inverse document frequency for documents |
|
@@ -94,8 +94,8 @@ Each row of the click / annotation dataset contains the following attributes. Us
|
|
94 |
| query_document_embedding | Tensor[Tensor[float16]] | BERT CLS token |
|
95 |
| label | Tensor[int32] | Relevance judgments on a scale from 0 (bad) to 4 (excellent) |
|
96 |
| bm25 | Tensor[float32] | BM25 score for documents |
|
97 |
-
|
|
98 |
-
|
|
99 |
| tf_idf | Tensor[float32] | TF-IDF score for documents |
|
100 |
| tf | Tensor[float32] | Term frequency for documents |
|
101 |
| idf | Tensor[float32] | Inverse document frequency for documents |
|
|
|
65 |
| serp_height | Tensor[int32] | Pixel height of a document on the screen |
|
66 |
| slipoff_count_after_click | Tensor[int32] | Number of times a document was scrolled off the screen after previously clicking on it |
|
67 |
| bm25 | Tensor[float32] | BM25 score for documents |
|
68 |
+
| bm25_title | Tensor[float32] | BM25 score for document titles |
|
69 |
+
| bm25_abstract | Tensor[float32] | BM25 score for document abstracts |
|
70 |
| tf_idf | Tensor[float32] | TF-IDF score for documents |
|
71 |
| tf | Tensor[float32] | Term frequency for documents |
|
72 |
| idf | Tensor[float32] | Inverse document frequency for documents |
|
|
|
94 |
| query_document_embedding | Tensor[Tensor[float16]] | BERT CLS token |
|
95 |
| label | Tensor[int32] | Relevance judgments on a scale from 0 (bad) to 4 (excellent) |
|
96 |
| bm25 | Tensor[float32] | BM25 score for documents |
|
97 |
+
| bm25_title | Tensor[float32] | BM25 score for document titles |
|
98 |
+
| bm25_abstract | Tensor[float32] | BM25 score for document abstracts |
|
99 |
| tf_idf | Tensor[float32] | TF-IDF score for documents |
|
100 |
| tf | Tensor[float32] | Term frequency for documents |
|
101 |
| idf | Tensor[float32] | Inverse document frequency for documents |
|
baidu-ultr_baidu-mlm-ctr.py
CHANGED
@@ -74,8 +74,8 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
|
|
74 |
"slipoff_count_after_click": Sequence(Value("int32")),
|
75 |
### LTR features
|
76 |
"bm25": Sequence(Value("float32")),
|
77 |
-
"
|
78 |
-
"
|
79 |
"tf_idf": Sequence(Value("float32")),
|
80 |
"tf": Sequence(Value("float32")),
|
81 |
"idf": Sequence(Value("float32")),
|
@@ -105,8 +105,8 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
|
|
105 |
"label": Sequence(Value("int32")),
|
106 |
### LTR features
|
107 |
"bm25": Sequence(Value("float32")),
|
108 |
-
"
|
109 |
-
"
|
110 |
"tf_idf": Sequence(Value("float32")),
|
111 |
"tf": Sequence(Value("float32")),
|
112 |
"idf": Sequence(Value("float32")),
|
@@ -164,8 +164,8 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
|
|
164 |
"serp_height",
|
165 |
"slipoff_count_after_click",
|
166 |
"bm25",
|
167 |
-
"
|
168 |
-
"
|
169 |
"tf_idf",
|
170 |
"tf",
|
171 |
"idf",
|
@@ -211,8 +211,8 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
|
|
211 |
"query_document_embedding",
|
212 |
"label",
|
213 |
"bm25",
|
214 |
-
"
|
215 |
-
"
|
216 |
"tf_idf",
|
217 |
"tf",
|
218 |
"idf",
|
@@ -261,21 +261,26 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
|
|
261 |
aggregated per query. E.g., click, position, query_document_embeddings, etc.
|
262 |
:return:
|
263 |
"""
|
|
|
264 |
for file in files:
|
265 |
df = pd.read_feather(file)
|
266 |
-
|
|
|
267 |
sample_key = None
|
268 |
sample = None
|
269 |
|
270 |
for i in range(len(df)):
|
271 |
row = df.iloc[i]
|
272 |
|
273 |
-
if
|
274 |
-
|
|
|
|
|
275 |
yield sample_key, sample
|
276 |
|
277 |
-
|
278 |
-
sample_key
|
|
|
279 |
sample = {"n": 0}
|
280 |
|
281 |
for column in query_columns:
|
|
|
74 |
"slipoff_count_after_click": Sequence(Value("int32")),
|
75 |
### LTR features
|
76 |
"bm25": Sequence(Value("float32")),
|
77 |
+
"bm25_title": Sequence(Value("float32")),
|
78 |
+
"bm25_abstract": Sequence(Value("float32")),
|
79 |
"tf_idf": Sequence(Value("float32")),
|
80 |
"tf": Sequence(Value("float32")),
|
81 |
"idf": Sequence(Value("float32")),
|
|
|
105 |
"label": Sequence(Value("int32")),
|
106 |
### LTR features
|
107 |
"bm25": Sequence(Value("float32")),
|
108 |
+
"bm25_title": Sequence(Value("float32")),
|
109 |
+
"bm25_abstract": Sequence(Value("float32")),
|
110 |
"tf_idf": Sequence(Value("float32")),
|
111 |
"tf": Sequence(Value("float32")),
|
112 |
"idf": Sequence(Value("float32")),
|
|
|
164 |
"serp_height",
|
165 |
"slipoff_count_after_click",
|
166 |
"bm25",
|
167 |
+
"bm25_title",
|
168 |
+
"bm25_abstract",
|
169 |
"tf_idf",
|
170 |
"tf",
|
171 |
"idf",
|
|
|
211 |
"query_document_embedding",
|
212 |
"label",
|
213 |
"bm25",
|
214 |
+
"bm25_title",
|
215 |
+
"bm25_abstract",
|
216 |
"tf_idf",
|
217 |
"tf",
|
218 |
"idf",
|
|
|
261 |
aggregated per query. E.g., click, position, query_document_embeddings, etc.
|
262 |
:return:
|
263 |
"""
|
264 |
+
|
265 |
for file in files:
|
266 |
df = pd.read_feather(file)
|
267 |
+
current_query = None
|
268 |
+
query_no = 0
|
269 |
sample_key = None
|
270 |
sample = None
|
271 |
|
272 |
for i in range(len(df)):
|
273 |
row = df.iloc[i]
|
274 |
|
275 |
+
if current_query != row["query_md5"]:
|
276 |
+
query_no += 1
|
277 |
+
|
278 |
+
if current_query is not None:
|
279 |
yield sample_key, sample
|
280 |
|
281 |
+
current_query = row["query_md5"]
|
282 |
+
# Use the query number in sample_key as query_ids are not unique.
|
283 |
+
sample_key = f"{file}-{query_no}"
|
284 |
sample = {"n": 0}
|
285 |
|
286 |
for column in query_columns:
|