Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_strategy_cvr
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
rank
gm_strategy_cvr
Commits
13d02840
Commit
13d02840
authored
Jul 30, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get result
parent
4d4e4fa5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
main_portrait.py
src/main_portrait.py
+2
-1
test.py
src/test.py
+9
-7
portrait.py
src/utils/portrait.py
+2
-2
No files found.
src/main_portrait.py
View file @
13d02840
...
...
@@ -59,7 +59,8 @@ def main():
device_dict
=
device_fe
.
get_device_dict_from_redis
()
diary_dict
=
diary_fe
.
get_diary_dict_from_redis
()
print
(
"redis data: "
+
str
(
len
(
device_dict
))
+
" "
+
str
(
len
(
diary_dict
)))
tractate_dict
=
tractate_fe
.
get_tractate_dict_from_redis
()
print
(
"redis data: "
+
str
(
len
(
device_dict
))
+
" "
+
str
(
len
(
diary_dict
))
+
" "
+
str
(
len
(
tractate_dict
)))
diary_save_path
=
"/home/gmuser/data/models/diary/1596083349"
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
...
...
src/test.py
View file @
13d02840
...
...
@@ -13,18 +13,20 @@ from utils.portrait import (get_user_portrait_tag3_read_v2, user_portrait_tag3_g
if
__name__
==
"__main__"
:
time_begin
=
time
.
time
()
device_dict
=
device_fe
.
get_device_dict_from_redis
()
tractate_dict
=
tractate_fe
.
get_tractate_dict_from_redis
()
print
(
"redis data: "
+
str
(
len
(
device_dict
))
+
" "
+
str
(
len
(
tractate_dict
)))
device_id
=
"androidid_a25a1129c0b38f7b"
tractate_save_path
=
"/home/gmuser/data/models/tractate/1596092061"
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
read_list
,
_
=
get_user_portrait_tag3_read_v2
(
device_id
,
"tractate"
)
print
(
len
(
read_list
))
print
(
read_list
[:
10
])
res
=
user_portrait_tag3_get_candidate_unread_list
(
device_id
,
"tractate"
)
print
(
len
(
res
))
print
(
res
[:
10
])
tractate_ids
=
user_portrait_tag3_get_candidate_unread_list
(
device_id
,
"tractate"
)
print
(
"tractate_ids: "
+
str
(
len
(
tractate_ids
)))
res
=
model_predict_tractate
(
device_id
,
tractate_ids
,
device_dict
,
tractate_dict
,
tractate_predict_fn
)
print
(
"res: "
+
str
(
len
(
res
)))
# user_portrait_tag3_write_ctcvr_data(device_id, "tractate", res[:500])
total_time
=
(
time
.
time
()
-
time_begin
)
/
60
print
(
"total cost {:.2f} mins at {}"
.
format
(
total_time
,
datetime
.
datetime
.
now
()))
src/utils/portrait.py
View file @
13d02840
...
...
@@ -86,7 +86,7 @@ def get_n_unread_data_from_ids(data, size, read_lst):
def
_user_portrait_tag3_get_ctcvr_candidate_key
(
device_id
,
content_type
):
"""
device_id:
content_type: diary
content_type: diary
, tractate
return:
"""
return
"doris:user_portrait:tag3:ctcvr:candidate:{}:device_id:"
.
format
(
content_type
)
+
str
(
device_id
)
...
...
@@ -151,7 +151,7 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type, size=5
def
user_portrait_tag3_write_ctcvr_data
(
device_id
,
content_type
,
data
):
"""
device_id:
content_type: diary
content_type: diary
, tractate
data: [15420031, 15531030, 16049931, 15335637, 16443431]
return:
"""
...
...
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