Commit 9a80dae2 authored by 段英荣's avatar 段英荣

Merge branch 'gyz' into 'master'

Gyz

See merge request alpha/physical!481
parents 6947ae00 6d5516dc
......@@ -411,7 +411,7 @@ class ESPerform(object):
}
},
"_source": {
"include": ["id", "user_id"]
"include": ["id", "user_id", "latest_reply_time"]
},
"sort": [
{"latest_reply_time": {"order": "desc"}},
......@@ -440,8 +440,15 @@ class ESPerform(object):
for item in result_dict["hits"]:
topic_id_dict[str(item["_source"]["id"])] = item["_source"]["user_id"]
topic_id_dict_latest_reply_time = list()
for item in result_dict["hits"]:
topic_id_dict_latest_reply_time.append([item["_source"]["id"], item["_source"]["latest_reply_time"]])
logging.info("topic_id_list:%s" % str(topic_id_dict))
logging.info("linucb_tag_id_list_2_same_tagset_ids:" + str(tag_id))
logging.info("linucb_tag_id_list_2_same_tagset_ids_2_topics_detail:" + str(topic_id_dict_latest_reply_time))
return topic_id_list, topic_id_dict
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
......@@ -11,6 +11,7 @@ import json
import pickle
from django.conf import settings
from libs.error import logging_exception
from gm_logging.general import log_maidian
class LinUCB:
d = 2
......@@ -150,8 +151,12 @@ class LinUCB:
ori_redis_tag_data = redis_cli.hget(redis_key, tag_id)
if not ori_redis_tag_data:
log_dict = {"device_id": device_id, "tag_id": tag_id, "ltype": "create", "biz_type": "lin_tag"}
log_maidian(log_dict, 'physical')
LinUCB.init_device_id_linucb_info(redis_client, redis_prefix, device_id,[tag_id])
else:
log_dict = {"device_id": device_id, "tag_id": tag_id, "ltype": "update", "biz_type": "lin_tag"}
log_maidian(log_dict, 'physical')
ori_redis_tag_dict = pickle.loads(ori_redis_tag_data)
new_Aa_matrix = ori_redis_tag_dict["Aa"] + np.dot(xa, xaT)
new_AaI_matrix = np.linalg.solve(new_Aa_matrix, np.identity(cls.d))
......
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