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
ba543722
Commit
ba543722
authored
Mar 27, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
8ee7b05b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
linucb.py
linucb/views/linucb.py
+2
-2
topic.py
search/views/topic.py
+3
-3
No files found.
linucb/views/linucb.py
View file @
ba543722
...
...
@@ -86,10 +86,10 @@ class LinUCB:
for
top_score
in
sorted_np_score_list
:
for
top_score_index
in
np_score_dict
[
top_score
]:
top_tag_set
.
add
(
str
(
tag_list
[
top_score_index
],
encoding
=
"utf-8"
))
if
len
(
top_tag_set
)
>=
10
:
if
len
(
top_tag_set
)
>=
10
0
:
break
if
len
(
top_tag_set
)
>=
10
:
if
len
(
top_tag_set
)
>=
10
0
:
break
logging
.
info
(
"duan add,device_id:
%
s,sorted_np_score_list:
%
s,np_score_dict:
%
s"
%
(
str
(
device_id
),
str
(
sorted_np_score_list
),
str
(
np_score_dict
)))
...
...
search/views/topic.py
View file @
ba543722
...
...
@@ -123,15 +123,15 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# break
have_read_topic_id_list
.
extend
(
topic_id_list
)
if
len
(
have_read_topic_id_list
)
>
5
000
:
cut_len
=
len
(
have_read_topic_id_list
)
-
5
000
if
len
(
have_read_topic_id_list
)
>
30
000
:
cut_len
=
len
(
have_read_topic_id_list
)
-
30
000
have_read_topic_id_list
=
have_read_topic_id_list
[
cut_len
:]
redis_dict
=
{
"have_read_topic_list"
:
json
.
dumps
(
have_read_topic_id_list
),
}
redis_client
.
hmset
(
redis_key
,
redis_dict
)
# 每个session key保存15分钟
redis_client
.
expire
(
redis_key
,
60
*
60
*
24
*
3
)
redis_client
.
expire
(
redis_key
,
60
*
60
*
24
*
3
0
)
return
topic_id_list
except
:
...
...
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