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
09f9349e
Commit
09f9349e
authored
Mar 12, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'similar_sort' into 'master'
modify See merge request
!163
parents
251baa05
b5f36b03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
collect_data.py
linucb/views/collect_data.py
+2
-1
linucb.py
linucb/views/linucb.py
+2
-1
No files found.
linucb/views/collect_data.py
View file @
09f9349e
...
...
@@ -55,8 +55,9 @@ class CollectData(object):
LinUCB
.
init_device_id_linucb_info
(
redis_client
,
self
.
linucb_matrix_redis_prefix
,
device_id
,
recommend_tag_list
)
else
:
user_feature
=
user_feature
if
user_feature
else
self
.
user_feature
recommend_tag_list
=
LinUCB
.
linucb_recommend_tag
(
redis_linucb_tag_data_dict
,
user_feature
,
list
(
redis_linucb_tag_data_dict
.
keys
()))
recommend_tag_list
=
LinUCB
.
linucb_recommend_tag
(
device_id
,
redis_linucb_tag_data_dict
,
user_feature
,
list
(
redis_linucb_tag_data_dict
.
keys
()))
logging
.
info
(
"duan add,device_id:
%
s,recommend_tag_list:
%
s"
%
(
str
(
device_id
),
str
(
recommend_tag_list
)))
if
len
(
recommend_tag_list
)
>
0
:
tag_recommend_redis_key
=
self
.
linucb_recommend_redis_prefix
+
str
(
device_id
)
redis_client
.
set
(
tag_recommend_redis_key
,
json
.
dumps
(
recommend_tag_list
))
...
...
linucb/views/linucb.py
View file @
09f9349e
...
...
@@ -33,7 +33,7 @@ class LinUCB:
return
list
()
@classmethod
def
linucb_recommend_tag
(
cls
,
redis_linucb_tag_data_dict
,
user_features_list
,
tag_list
):
def
linucb_recommend_tag
(
cls
,
device_id
,
redis_linucb_tag_data_dict
,
user_features_list
,
tag_list
):
"""
:remark 获取推荐标签
:param redis_linucb_tag_data_dict:
...
...
@@ -91,6 +91,7 @@ class LinUCB:
if
len
(
top_tag_set
)
>=
10
:
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
)))
return
list
(
top_tag_set
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
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