提交 16d6bd7c 编写于 作者: D dzhwinter

"fix label genenerate type. avoid IVector create error when init label"

上级 d7ef5624
...@@ -154,9 +154,9 @@ def gen_pair(querylist, partial_order="full"): ...@@ -154,9 +154,9 @@ def gen_pair(querylist, partial_order="full"):
for i, query_left in enumerate(querylist): for i, query_left in enumerate(querylist):
for j, query_right in enumerate(querylist): for j, query_right in enumerate(querylist):
if query_left.relevance_score > query_right.relevance_score: if query_left.relevance_score > query_right.relevance_score:
yield np.ones(1), np.array(query_left.feature_vector), np.array(query_right.feature_vector) yield 1, np.array(query_left.feature_vector), np.array(query_right.feature_vector)
else: else:
yield np.ones(1), np.array(query_left.feature_vector), np.array(query_right.feature_vector) yield 1, np.array(query_left.feature_vector), np.array(query_right.feature_vector)
elif partial_order == "neighbour": elif partial_order == "neighbour":
# C(n) # C(n)
...@@ -165,9 +165,9 @@ def gen_pair(querylist, partial_order="full"): ...@@ -165,9 +165,9 @@ def gen_pair(querylist, partial_order="full"):
query_left = querylist[k] query_left = querylist[k]
query_right = querylist[k+1] query_right = querylist[k+1]
if query_left.relevance_score > query_right.relevance_score: if query_left.relevance_score > query_right.relevance_score:
yield np.ones(1), np.array(query_left.feature_vector), np.array(query_right.feature_vector) yield 1, np.array(query_left.feature_vector), np.array(query_right.feature_vector)
else: else:
yield np.ones(1), np.array(query_left.feature_vector), np.array(query_right.feature_vector) yield 1, np.array(query_left.feature_vector), np.array(query_right.feature_vector)
k += 1 k += 1
else: else:
raise ValueError("unsupport parameter of partial_order, Only can be neighbour or full") raise ValueError("unsupport parameter of partial_order, Only can be neighbour or full")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册