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
80a32c42
Commit
80a32c42
authored
Apr 17, 2019
by
黄凯
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hk' into 'master'
linucb collection tag See merge request alpha/physical!281
parents
76379c4c
fc99626e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
collect_data.py
linucb/views/collect_data.py
+12
-9
No files found.
linucb/views/collect_data.py
View file @
80a32c42
...
...
@@ -188,8 +188,8 @@ class CollectData(object):
reward
=
1
if
is_click
or
is_vote
else
0
logging
.
info
(
"positive tag_list,device_id:
%
s,topic_id:
%
s,tag_list:
%
s"
%
(
str
(
device_id
),
str
(
topic_id
),
str
(
tag_list
)))
for
tag_id
in
tag_list
:
str
(
device_id
),
str
(
topic_id
),
str
(
click_topic_
tag_list
)))
for
tag_id
in
click_topic_
tag_list
:
self
.
update_user_linucb_tag_info
(
reward
,
device_id
,
tag_id
,
user_feature
)
# 更新该用户的推荐tag数据,放在 更新完成user tag行为信息之后
...
...
@@ -216,14 +216,17 @@ class CollectData(object):
topic_tag_id_dict
=
dict
()
tag_list
=
list
()
exposure_sql_query_results
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id__in
=
exposure_topic_id_list
)
.
values_list
(
"topic_id"
,
"tag_id"
,
"is_online"
)
for
topic_id
,
tag_id
,
is_online
in
exposure_sql_query_results
:
exposure_sql_query_results
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id__in
=
exposure_topic_id_list
)
.
values_list
(
"topic_id"
,
"tag_id"
,
"is_online"
,
"is_collection"
)
if
len
(
exposure_sql_query_results
)
>
0
:
for
topic_id
,
tag_id
,
is_online
,
is_collection
in
exposure_sql_query_results
:
if
is_online
and
is_collection
==
1
:
tag_list
.
append
(
tag_id
)
if
is_online
:
#
tag_sql_query_results = Tag.objects.using(settings.SLAVE_DB_NAME).filter(
#
id=tag_id).values_list("id", "collection", "is_ai")
#
for id, collection, is_ai in tag_sql_query_results:
# if collection == 1 or is_ai == 1
:
tag_list
.
append
(
tag_
id
)
tag_sql_query_results
=
Tag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
id
=
tag_id
)
.
values_list
(
"id"
,
"collection"
,
"is_ai"
)
for
id
,
collection
,
is_ai
in
tag_sql_query_results
:
if
(
is_ai
==
1
)
and
id
not
in
tag_list
:
tag_list
.
append
(
id
)
if
topic_id
not
in
topic_tag_id_dict
:
topic_tag_id_dict
[
topic_id
]
=
list
()
...
...
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