Commit d7d30198 authored by 段英荣's avatar 段英荣

modify linucb

parent 21b3863b
...@@ -102,6 +102,9 @@ class LinUCB: ...@@ -102,6 +102,9 @@ class LinUCB:
redis_key = redis_prefix + str(device_id) redis_key = redis_prefix + str(device_id)
ori_redis_tag_dict = redis_cli.hget(redis_key, tag_id) ori_redis_tag_dict = redis_cli.hget(redis_key, tag_id)
if not ori_redis_tag_dict:
LinUCB.init_device_id_linucb_info(redis_client, redis_prefix, device_id,[tag_id])
else:
new_Aa_matrix = ori_redis_tag_dict["Aa"] + np.dot(xa, xaT) 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)) new_AaI_matrix = np.linalg.solve(new_Aa_matrix, np.identity(cls.d))
new_ba_matrix = ori_redis_tag_dict["ba"] + r*xa new_ba_matrix = ori_redis_tag_dict["ba"] + r*xa
......
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