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
alpha
physical
Commits
75ecd6c7
Commit
75ecd6c7
authored
Apr 08, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hk' into 'master'
revise recommend tags See merge request alpha/physical!223
parents
02f8a708
77676def
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
28 deletions
+7
-28
Project.xml
.idea/codeStyles/Project.xml
+0
-25
collect_data.py
linucb/views/collect_data.py
+7
-3
No files found.
.idea/codeStyles/Project.xml
View file @
75ecd6c7
...
...
@@ -24,29 +24,5 @@
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options
enabled=
"false"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
/>
</DBN-PSQL>
<DBN-SQL>
<case-options
enabled=
"false"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
>
<option
name=
"STATEMENT_SPACING"
value=
"one_line"
/>
<option
name=
"CLAUSE_CHOP_DOWN"
value=
"chop_down_if_statement_long"
/>
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>
\ No newline at end of file
linucb/views/collect_data.py
View file @
75ecd6c7
...
...
@@ -2,6 +2,7 @@
# !/usr/bin/env python
from
kafka
import
KafkaConsumer
import
random
from
libs.cache
import
redis_client
import
logging
from
linucb.views.linucb
import
LinUCB
...
...
@@ -73,8 +74,9 @@ class CollectData(object):
have_read_topic_id_list
=
Tools
.
get_have_read_topic_id_list
(
device_id
,
-
1
,
TopicPageType
.
HOME_RECOMMEND
)
recommend_topic_id_list
=
list
()
for
index
in
range
(
0
,
1000
):
for
tag_id
in
recommend_tag_list
[
0
:
5
]:
for
index
in
range
(
0
,
100
):
recommend_topic_id_list_random
=
list
()
for
tag_id
in
recommend_tag_list
[
0
:
100
]:
redis_tag_id_key
=
self
.
tag_topic_id_redis_prefix
+
str
(
tag_id
)
redis_tag_id_data
=
redis_client
.
get
(
redis_tag_id_key
)
tag_topic_id_list
=
json
.
loads
(
redis_tag_id_data
)
if
redis_tag_id_data
else
[]
...
...
@@ -86,8 +88,10 @@ class CollectData(object):
if
len
(
tag_topic_id_list
)
>
index
:
for
topic_id
in
tag_topic_id_list
[
index
:]:
if
topic_id
not
in
have_read_topic_id_list
and
topic_id
not
in
recommend_topic_id_list
:
recommend_topic_id_list
.
append
(
topic_id
)
recommend_topic_id_list
_random
.
append
(
topic_id
)
break
random
.
shuffle
(
recommend_topic_id_list_random
)
recommend_topic_id_list
.
extend
(
recommend_topic_id_list_random
)
topic_recommend_redis_key
=
self
.
linucb_recommend_topic_id_prefix
+
str
(
device_id
)
redis_data_dict
=
{
...
...
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