Commit 659481a2 authored by 段英荣's avatar 段英荣

Merge branch 'linUCB' into 'master'

modify linucb

See merge request alpha/physical!125
parents 71973498 7aeee446
......@@ -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("consume_data_from_kafka error!")
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False
......@@ -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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment