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
cb4429a4
Commit
cb4429a4
authored
Jul 23, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try predict
parent
df27fde1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
main_portrait.py
src/main_portrait.py
+9
-3
portrait.py
src/utils/portrait.py
+2
-4
No files found.
src/main_portrait.py
View file @
cb4429a4
import
datetime
import
datetime
from
models.esmm.fe
import
(
get_device_dict_from_redis
,
get_diary_dict_from_redis
)
from
models.esmm.model
import
model_predict_diary
from
utils.cache
import
redis_client2
from
utils.cache
import
redis_client2
from
utils.portrait
import
user_portrait_tag3_get_candidate_unread_list
,
user_portrait_tag3_write_ctcvr_data
from
utils.portrait
import
(
user_portrait_tag3_get_candidate_unread_list
,
user_portrait_tag3_write_ctcvr_data
)
def
user_portrait_scan_info
():
def
user_portrait_scan_info
():
...
@@ -28,7 +30,11 @@ def user_portrait_scan_info():
...
@@ -28,7 +30,11 @@ def user_portrait_scan_info():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
device_dict
=
get_device_dict_from_redis
()
diary_dict
=
get_diary_dict_from_redis
()
device_id
=
"androidid_a25a1129c0b38f7b"
device_id
=
"androidid_a25a1129c0b38f7b"
a
=
[
15420031
,
15531030
,
16049931
,
15335637
,
16443431
,
16269779
,
9389022
,
16710435
,
16258498
,
16435592
]
model_path
=
"/home/gmuser/data/models/1595501144"
user_portrait_tag3_write_ctcvr_data
(
device_id
,
"diary"
,
a
)
diary_ids
=
user_portrait_tag3_get_candidate_unread_list
(
device_id
,
"diary"
)
model_predict_diary
(
device_id
,
diary_ids
)
# user_portrait_scan_info()
# user_portrait_scan_info()
src/utils/portrait.py
View file @
cb4429a4
...
@@ -118,7 +118,7 @@ def user_portrait_tag3_get_candidate_dict(device_id, content_type, latest=False)
...
@@ -118,7 +118,7 @@ def user_portrait_tag3_get_candidate_dict(device_id, content_type, latest=False)
return
{}
return
{}
def
user_portrait_tag3_get_candidate_unread_list
(
device_id
,
content_type
):
def
user_portrait_tag3_get_candidate_unread_list
(
device_id
,
content_type
,
size
=
500
):
"""
"""
device_id:
device_id:
content_type: diary
content_type: diary
...
@@ -128,7 +128,7 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type):
...
@@ -128,7 +128,7 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type):
read_list
,
_
=
get_user_portrait_tag3_read_v2
(
device_id
,
content_type
)
read_list
,
_
=
get_user_portrait_tag3_read_v2
(
device_id
,
content_type
)
diary_dict
=
user_portrait_tag3_get_candidate_dict
(
device_id
,
"diary"
)
diary_dict
=
user_portrait_tag3_get_candidate_dict
(
device_id
,
"diary"
)
if
diary_dict
:
if
diary_dict
:
lol
=
remove_read_with_size
(
diary_dict
.
values
(),
"diary"
,
read_list
,
500
)
lol
=
remove_read_with_size
(
diary_dict
.
values
(),
"diary"
,
read_list
,
size
)
queue
=
merge_lists
(
*
lol
)
queue
=
merge_lists
(
*
lol
)
return
queue
return
queue
...
@@ -142,7 +142,5 @@ def user_portrait_tag3_write_ctcvr_data(device_id, content_type, data):
...
@@ -142,7 +142,5 @@ def user_portrait_tag3_write_ctcvr_data(device_id, content_type, data):
"""
"""
if
data
:
if
data
:
key
=
_user_portrait_tag3_get_ctcvr_candidate_key
(
device_id
,
content_type
)
key
=
_user_portrait_tag3_get_ctcvr_candidate_key
(
device_id
,
content_type
)
redis_client4
.
delete
(
key
)
redis_client4
.
set
(
key
,
json
.
dumps
(
data
))
redis_client4
.
set
(
key
,
json
.
dumps
(
data
))
# redis_client4.rpush(key, *data)
redis_client4
.
expire
(
key
,
60
*
60
*
24
*
30
)
redis_client4
.
expire
(
key
,
60
*
60
*
24
*
30
)
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