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
18aa408c
Commit
18aa408c
authored
Jul 24, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add grey
parent
b48b9ccd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
main_portrait.py
src/main_portrait.py
+6
-4
grey.py
src/utils/grey.py
+14
-0
No files found.
src/main_portrait.py
View file @
18aa408c
...
...
@@ -7,6 +7,7 @@ import tensorflow as tf
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.grey
import
recommed_service_category_device_id_by_tail
from
utils.portrait
import
(
user_portrait_tag3_get_candidate_dict
,
user_portrait_tag3_get_candidate_unread_list
,
user_portrait_tag3_write_ctcvr_data
)
...
...
@@ -25,10 +26,11 @@ def user_portrait_scan_info(device_dict, diary_dict, predict_fn):
key
=
str
(
key
,
"utf-8"
)
device_id
=
key
.
split
(
":"
)[
-
1
]
if
(
user_portrait_tag3_get_candidate_dict
(
device_id
,
"diary"
)):
all_count
+=
1
print
(
str
(
all_count
)
+
": "
+
device_id
)
offline_predict
(
device_id
,
device_dict
,
diary_dict
,
predict_fn
)
if
recommed_service_category_device_id_by_tail
(
device_id
,
[
"c"
,
"d"
,
"e"
,
"f"
]):
if
(
user_portrait_tag3_get_candidate_dict
(
device_id
,
"diary"
)):
all_count
+=
1
print
(
str
(
all_count
)
+
": "
+
device_id
)
offline_predict
(
device_id
,
device_dict
,
diary_dict
,
predict_fn
)
print
(
"all count: "
+
str
(
all_count
))
print
(
"scan done "
+
str
(
datetime
.
datetime
.
now
()))
...
...
src/utils/grey.py
0 → 100644
View file @
18aa408c
import
hashlib
def
recommed_service_category_device_id_by_tail
(
device_id
,
tail_list
=
[]):
try
:
"""设备品类显示, 是否命中灰度"""
if
not
device_id
:
return
False
hd_id
=
hashlib
.
md5
(
str
(
device_id
)
.
encode
())
.
hexdigest
()
is_gray
=
hd_id
[
-
1
]
in
tail_list
return
is_gray
except
Exception
as
e
:
return
False
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