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
659481a2
Commit
659481a2
authored
Feb 27, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'linUCB' into 'master'
modify linucb See merge request
alpha/physical!125
parents
71973498
7aeee446
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
collect_data.py
linucb/views/collect_data.py
+4
-3
linucb.py
linucb/views/linucb.py
+5
-3
requirements.txt
requirements.txt
+2
-0
No files found.
linucb/views/collect_data.py
View file @
659481a2
...
...
@@ -7,6 +7,7 @@ import logging
from
linucb.views.linucb
import
LinUCB
import
json
from
trans2es.models.tag
import
TopicTag
import
traceback
class
KafkaManager
(
object
):
# kafka信息
...
...
@@ -42,7 +43,7 @@ class CollectData(object):
return
redis_linucb_tag_data_dict
except
:
logging
.
error
(
"
get_user_linucb_info error!"
)
logging
.
error
(
"
catch exception,err_msg:
%
s"
%
traceback
.
format_exc
()
)
return
dict
()
def
update_recommend_tag_list
(
self
,
device_id
,
user_feature
=
None
):
...
...
@@ -64,7 +65,7 @@ class CollectData(object):
return
True
except
:
logging
.
error
(
"
get_recommend_tag_list error!"
)
logging
.
error
(
"
catch exception,err_msg:
%
s"
%
traceback
.
format_exc
()
)
return
False
def
update_user_linucb_tag_info
(
self
,
reward
,
device_id
,
tag_id
,
user_feature
=
None
):
...
...
@@ -108,5 +109,5 @@ class CollectData(object):
return
True
except
:
logging
.
error
(
"c
onsume_data_from_kafka error!"
)
logging
.
error
(
"c
atch exception,err_msg:
%
s"
%
traceback
.
format_exc
()
)
return
False
linucb/views/linucb.py
View file @
659481a2
...
...
@@ -6,6 +6,7 @@ import redis
from
libs.cache
import
redis_client
from
trans2es.models.tag
import
Tag
import
logging
import
traceback
class
LinUCB
:
d
=
2
...
...
@@ -26,7 +27,7 @@ class LinUCB:
return
cls
.
default_tag_list
[:
20
]
except
:
logging
.
error
(
"
get_tag_list error!"
)
logging
.
error
(
"
catch exception,err_msg:
%
s"
%
traceback
.
format_exc
()
)
return
list
()
@classmethod
...
...
@@ -60,7 +61,7 @@ class LinUCB:
return
[
art_max
]
except
:
logging
.
error
(
"
linucb_recommend_tag error!"
)
logging
.
error
(
"
catch exception,err_msg:
%
s"
%
traceback
.
format_exc
()
)
return
[]
@classmethod
...
...
@@ -115,5 +116,5 @@ class LinUCB:
redis_cli
.
hset
(
redis_key
,
tag_id
,
user_tag_dict
)
return
True
except
:
logging
.
error
(
"
update_linucb_info error!"
)
logging
.
error
(
"
catch exception,err_msg:
%
s"
%
traceback
.
format_exc
()
)
return
False
\ No newline at end of file
requirements.txt
View file @
659481a2
...
...
@@ -12,6 +12,8 @@ PyMySQL==0.9.2
gunicorn
==19.9.0
gevent
==1.3.7
pypinyin
==0.34.1
numpy
==1.16.2
lz4
==2.1.6
git+ssh://git@git.wanmeizhensuo.com/backend/gm-rpcd.git@master
git+ssh://git@git.wanmeizhensuo.com/backend/helios.git@master
...
...
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