Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
d6089859
Commit
d6089859
authored
Feb 12, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test score
parent
bab5269d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
topic.py
search/utils/topic.py
+9
-1
trans2es_data2es_parallel.py
trans2es/management/commands/trans2es_data2es_parallel.py
+3
-3
No files found.
search/utils/topic.py
View file @
d6089859
...
@@ -93,7 +93,7 @@ class TopicUtils(object):
...
@@ -93,7 +93,7 @@ class TopicUtils(object):
return
[]
return
[]
@classmethod
@classmethod
def
get_recommend_topic_ids
(
cls
,
user_id
,
offset
,
size
,
query
=
None
,
query_type
=
TopicPageType
.
FIND_PAGE
,
filter_topic_id_list
=
[]):
def
get_recommend_topic_ids
(
cls
,
user_id
,
offset
,
size
,
query
=
None
,
query_type
=
TopicPageType
.
FIND_PAGE
,
filter_topic_id_list
=
[]
,
test_score
=
False
):
"""
"""
:需增加打散逻辑
:需增加打散逻辑
:remark:获取首页推荐帖子列表
:remark:获取首页推荐帖子列表
...
@@ -254,11 +254,19 @@ class TopicUtils(object):
...
@@ -254,11 +254,19 @@ class TopicUtils(object):
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
offset
=
offset
,
size
=
size
)
offset
=
offset
,
size
=
size
)
if
not
test_score
:
topic_id_dict
=
dict
()
topic_id_dict
=
dict
()
for
item
in
result_dict
[
"hits"
]:
for
item
in
result_dict
[
"hits"
]:
topic_id_dict
[
item
[
"_source"
][
"id"
]]
=
[
item
[
"_source"
][
"group_id"
],
item
[
"_source"
][
"user_id"
]]
topic_id_dict
[
item
[
"_source"
][
"id"
]]
=
[
item
[
"_source"
][
"group_id"
],
item
[
"_source"
][
"user_id"
]]
return
topic_id_dict
return
topic_id_dict
else
:
topic_id_dict
=
dict
()
for
item
in
result_dict
[
"hits"
]:
topic_id_dict
[
item
[
"_source"
][
"id"
]]
=
[
item
[
"_source"
][
"group_id"
],
item
[
"_source"
][
"user_id"
],
item
[
"_score"
]]
return
topic_id_dict
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
dict
()
return
dict
()
...
...
trans2es/management/commands/trans2es_data2es_parallel.py
View file @
d6089859
...
@@ -127,7 +127,7 @@ class Command(BaseCommand):
...
@@ -127,7 +127,7 @@ class Command(BaseCommand):
def
generate_topic_score_detail
(
self
):
def
generate_topic_score_detail
(
self
):
try
:
try
:
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
-
1
,
0
,
500
)
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
-
1
,
0
,
500
,
test_score
=
True
)
for
topic_id
in
topic_id_dict
:
for
topic_id
in
topic_id_dict
:
offline_score
=
0.0
offline_score
=
0.0
...
@@ -182,8 +182,8 @@ class Command(BaseCommand):
...
@@ -182,8 +182,8 @@ class Command(BaseCommand):
if
user_is_shadow
:
if
user_is_shadow
:
offline_score
=
offline_score
*
0.5
offline_score
=
offline_score
*
0.5
logging
.
info
(
"test_score,offline_score:
%
f,user_is_recommend:
%
f,group_is_recommend:
%
f,topic_level_score:
%
f,exposure_score:
%
f,uv_score:
%
f"
logging
.
info
(
"test_score
######score:
%
f
,offline_score:
%
f,user_is_recommend:
%
f,group_is_recommend:
%
f,topic_level_score:
%
f,exposure_score:
%
f,uv_score:
%
f"
%
(
offline_score
,
user_is_recommend
,
group_is_recommend
,
topic_level_score
,
exposure_score
,
uv_score
))
%
(
topic_id_dict
[
topic_id
][
2
],
offline_score
,
user_is_recommend
,
group_is_recommend
,
topic_level_score
,
exposure_score
,
uv_score
))
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment