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
钟尚武
physical
Commits
f2180794
Commit
f2180794
authored
Sep 20, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页接口增加linucb ctr特征的灰度实验
parent
bd93be7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
collect_data.py
linucb/views/collect_data.py
+1
-0
topic.py
search/views/topic.py
+8
-2
No files found.
linucb/views/collect_data.py
View file @
f2180794
...
...
@@ -232,6 +232,7 @@ class CollectData(object):
def
consume_data_from_kafka
(
self
,
topic_name
=
None
):
try
:
user_feature
=
[
1
,
1
]
# todo 之后用user tag的ctr数据替换
user_feature_ctr
=
[
0.5
,
0.5
]
kafka_consumer_obj
=
KafkaManager
.
get_kafka_consumer_ins
(
topic_name
)
...
...
search/views/topic.py
View file @
f2180794
...
...
@@ -125,7 +125,10 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
have_read_topic_id_list
.
extend
(
useful_topic_id_list
)
# linucb 推荐帖子
topic_recommend_redis_key
=
"physical:linucb:topic_recommend:device_id:"
+
str
(
device_id
)
if
STRATEGY_TYPE
.
CTR_GRAY
in
gray_list
:
topic_recommend_redis_key
=
"ctr_physical:linucb:topic_recommend:device_id:"
+
str
(
device_id
)
else
:
topic_recommend_redis_key
=
"physical:linucb:topic_recommend:device_id:"
+
str
(
device_id
)
recommend_topic_dict
=
redis_client
.
hgetall
(
topic_recommend_redis_key
)
linucb_recommend_topic_id_list
=
list
()
...
...
@@ -257,7 +260,10 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
def
get_home_recommend_pictorial_ids
(
user_id
=-
1
,
device_id
=
""
,
size
=
4
,
gray_list
=
[]):
try
:
pictorial_recommend_redis_key
=
"physical:linucb:pictorial_recommend:device_id:"
+
str
(
device_id
)
if
STRATEGY_TYPE
.
CTR_GRAY
in
gray_list
:
pictorial_recommend_redis_key
=
"ctr_physical:linucb:pictorial_recommend:device_id:"
+
str
(
device_id
)
else
:
pictorial_recommend_redis_key
=
"physical:linucb:pictorial_recommend:device_id:"
+
str
(
device_id
)
have_read_lin_pictorial_id_list
=
get_have_read_lin_pictorial_id_list
(
device_id
,
user_id
,
TopicPageType
.
HOME_RECOMMEND
)
pictorial_recommend_dict
=
redis_client
.
hgetall
(
pictorial_recommend_redis_key
)
...
...
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